:root {
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #eef1f5;
  --ink: #17202a;
  --muted: #7a8491;
  --line: #e3e7ec;
  --blue: #0a84ff;
  --blue-soft: #e8f3ff;
  --green: #28b878;
  --green-soft: #e8f8f0;
  --coral: #ff6f61;
  --coral-soft: #fff0ed;
  --amber: #c98a1a;
  --amber-soft: #fff6df;
  --red: #d7473f;
  --shadow: 0 12px 28px rgba(23, 32, 42, .07);
  --shadow-soft: 0 4px 14px rgba(23, 32, 42, .05);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

.initial-loader { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 15px; color: #6e6e73; background: #f5f5f7; }
.initial-loader p { margin: 0; font-size: 12px; }
.initial-loader-mark { width: 54px; height: 38px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(29,29,31,.1); border-radius: 8px; background: rgba(255,255,255,.82); box-shadow: 0 8px 24px rgba(29,29,31,.07); }
.initial-loader-mark span, .verification-loading > span { width: 5px; height: 5px; border-radius: 50%; background: #0071e3; animation: loading-dot 1s ease-in-out infinite; }
.initial-loader-mark span:nth-child(2), .verification-loading > span:nth-child(2) { animation-delay: .14s; }
.initial-loader-mark span:nth-child(3), .verification-loading > span:nth-child(3) { animation-delay: .28s; }
@keyframes loading-dot { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.page-title { margin: 0; font-size: 28px; letter-spacing: 0; line-height: 1.1; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.icon { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; vertical-align: middle; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 21px; height: 21px; }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 7px; padding: 0 14px; color: var(--ink); background: var(--surface); font-size: 13px; font-weight: 700; transition: .18s ease; }
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.button:focus-visible, .input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: 3px solid rgba(10, 132, 255, .18); outline-offset: 1px; }
.button-primary { color: #fff; background: var(--blue); }
.button-secondary { border-color: var(--line); background: var(--surface); }
.button-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.button-danger { color: #b63c35; background: var(--coral-soft); }
.button-small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.button-wide { width: 100%; }

.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; color: var(--ink); background: var(--surface); font-size: 14px; transition: border-color .18s ease, box-shadow .18s ease; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(10, 132, 255, .55); box-shadow: 0 0 0 3px rgba(10, 132, 255, .1); outline: none; }
.textarea { min-height: 108px; resize: vertical; line-height: 1.65; }
.label { display: block; margin: 0 0 7px; color: #586273; font-size: 12px; font-weight: 700; }
.field { display: grid; gap: 7px; }
.field + .field { margin-top: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; background: #f1f3f6; }
.login-wrap { width: min(420px, 100%); }
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--ink); box-shadow: 0 10px 20px rgba(23, 32, 42, .18); }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0; }
.brand-caption { margin-top: 3px; color: var(--muted); font-size: 12px; }
.login-card { padding: 28px; border: 1px solid rgba(227, 231, 236, .85); border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 25px; letter-spacing: 0; }
.login-card p { margin: 9px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.login-card .field + .field { margin-top: 14px; }
.login-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.login-hint { padding: 10px 12px; border-radius: 7px; background: var(--surface-soft); }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { display: flex; min-height: 100vh; flex-direction: column; padding: 22px 14px 16px; border-right: 1px solid var(--line); background: #fbfcfd; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px; }
.sidebar-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.sidebar-brand .brand-mark .icon { width: 18px; height: 18px; }
.sidebar-brand .brand-name { font-size: 15px; }
.sidebar-section { margin: 31px 7px 8px; color: #a2aab5; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.nav { display: grid; gap: 3px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 7px; padding: 11px 10px; color: #687282; background: transparent; font-size: 13px; font-weight: 700; text-align: left; transition: .18s ease; }
.nav-button:hover { color: var(--ink); background: var(--surface-soft); }
.nav-button.active { color: var(--blue); background: var(--blue-soft); }
.nav-button .icon { width: 17px; height: 17px; }
.sidebar-spacer { flex: 1; }
.agent-mini { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.agent-mini-head { display: flex; align-items: center; gap: 9px; }
.agent-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--blue); font-size: 16px; font-weight: 700; }
.agent-mini-name { min-width: 0; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-mini-status { margin-top: 3px; color: var(--green); font-size: 12px; }
.quota { margin-top: 13px; }
.quota-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.quota-track { height: 5px; overflow: hidden; margin-top: 7px; border-radius: 8px; background: var(--surface-soft); }
.quota-fill { height: 100%; border-radius: inherit; background: var(--blue); }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-user { min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; padding: 26px 52px 50px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.agent-picker { min-width: 170px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.view-head-actions { display: flex; align-items: center; gap: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card { min-height: 122px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); }
.stat-value { margin-top: 10px; font-size: 28px; font-weight: 700; letter-spacing: 0; }
.stat-note { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 14px; margin-top: 14px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.card-pad { padding: 19px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.card-title h2 { margin: 0; font-size: 15px; letter-spacing: 0; }
.card-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-title .button { flex: 0 0 auto; }
.preview-card { min-height: 328px; overflow: hidden; background: #f8fafc; }
.preview-top { display: flex; align-items: center; gap: 12px; padding: 19px; border-bottom: 1px solid var(--line); background: var(--surface); }
.preview-avatar { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--blue); font-size: 21px; font-weight: 700; }
.preview-name { font-size: 15px; font-weight: 700; }
.preview-subtitle { margin-top: 3px; color: var(--muted); font-size: 12px; }
.preview-bubble { width: min(82%, 480px); margin: 25px 19px 16px; padding: 13px 14px; border-radius: 5px 11px 11px 11px; color: #3c4654; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 12px; line-height: 1.7; }
.preview-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 19px; }
.preview-chip { padding: 7px 9px; border: 1px solid var(--line); border-radius: 16px; color: #637083; background: var(--surface); font-size: 12px; }
.chat-list { display: grid; gap: 0; }
.chat-row { display: grid; grid-template-columns: 1fr auto; gap: 15px; padding: 13px 0; border-top: 1px solid var(--line); }
.chat-row:first-child { border-top: 0; padding-top: 0; }
.chat-question { font-size: 12px; font-weight: 700; line-height: 1.5; }
.chat-answer { margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-source { align-self: start; padding: 4px 7px; border-radius: 5px; color: var(--green); background: var(--green-soft); font-size: 12px; white-space: nowrap; }
.empty { display: grid; place-items: center; min-height: 120px; color: var(--muted); font-size: 12px; text-align: center; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, .8fr); gap: 14px; align-items: start; }
.section-card { padding: 20px; }
.section-card + .section-card { margin-top: 14px; }
.section-card h2 { margin: 0; font-size: 15px; }
.section-card .section-intro { margin: 6px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle-label { font-size: 12px; font-weight: 700; }
.toggle-description { margin-top: 3px; color: var(--muted); font-size: 12px; }
.switch { position: relative; width: 41px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; border-radius: 20px; background: #d6dae1; transition: .18s ease; }
.switch-track::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(23,32,42,.18); transition: .18s ease; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }
.phone-wrap { position: sticky; top: 24px; display: grid; place-items: center; padding: 28px 0; border: 1px solid var(--line); border-radius: var(--radius); background: #edf1f5; }
.phone { width: min(282px, 86%); overflow: hidden; border: 7px solid #222a34; border-radius: 29px; background: #f5f7f9; box-shadow: 0 18px 30px rgba(23,32,42,.17); }
.phone-notch { width: 86px; height: 18px; margin: -1px auto 0; border-radius: 0 0 13px 13px; background: #222a34; }
.phone-header { display: flex; align-items: center; gap: 8px; padding: 17px 14px 12px; background: var(--surface); }
.phone-avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--blue); font-size: 14px; font-weight: 700; }
.phone-name { font-size: 12px; font-weight: 700; }
.phone-live { margin-top: 2px; color: var(--green); font-size: 12px; }
.phone-body { min-height: 280px; padding: 16px 12px 21px; }
.phone-greeting { max-width: 90%; padding: 9px 10px; border-radius: 5px 10px 10px 10px; background: var(--surface); box-shadow: var(--shadow-soft); color: #4b5563; font-size: 12px; line-height: 1.6; }
.phone-prompt { margin: 14px 2px 8px; color: var(--muted); font-size: 12px; }
.phone-input { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: #a0a7b1; font-size: 12px; }
.phone-send { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 7px; color: #fff; background: var(--blue); }

.kb-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 14px; align-items: start; }
.kb-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.search-box { position: relative; min-width: min(240px, 100%); flex: 1; }
.search-box .icon { position: absolute; top: 11px; left: 11px; color: var(--muted); }
.search-box .input { padding-left: 34px; }
.kb-list { display: grid; gap: 8px; }
.kb-item { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.kb-item:hover { border-color: #c9d0d9; box-shadow: var(--shadow-soft); }
.kb-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kb-question { font-size: 13px; font-weight: 700; line-height: 1.45; }
.kb-actions { display: flex; gap: 5px; }
.kb-answer { margin-top: 7px; color: #626d7b; font-size: 12px; line-height: 1.6; }
.kb-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 12px; }
.tag-blue { color: var(--blue); background: var(--blue-soft); }
.tag-green { color: var(--green); background: var(--green-soft); }
.tag-amber { color: var(--amber); background: var(--amber-soft); }
.editor { margin-top: 14px; }
.test-panel { position: sticky; top: 24px; }
.test-input { display: flex; gap: 7px; }
.test-input .input { min-width: 0; }
.test-results { display: grid; gap: 8px; margin-top: 13px; }
.test-result { padding: 11px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfd; }
.test-result-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; }
.score { color: var(--blue); }
.test-result p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.content-preview { margin-top: 14px; padding: 16px; border: 1px dashed #cfd6de; border-radius: 7px; background: #fafbfd; }
.announcement { padding: 10px 11px; border-left: 3px solid var(--coral); border-radius: 5px; background: var(--coral-soft); color: #7c443c; font-size: 12px; line-height: 1.55; }
.marquee { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.ad-preview { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 13px; border-radius: 7px; color: #fff; background: var(--ink); }
.ad-preview h3 { margin: 0; font-size: 12px; }
.ad-preview p { margin: 6px 0 0; color: #c6ced7; font-size: 12px; line-height: 1.5; }
.ad-preview .button { min-height: 29px; border-color: rgba(255,255,255,.15); color: #fff; background: rgba(255,255,255,.1); font-size: 12px; }

.agents-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.agents-table th { padding: 0 11px 10px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
.agents-table td { padding: 13px 11px; border-top: 1px solid var(--line); vertical-align: middle; }
.agent-cell { display: flex; align-items: center; gap: 9px; }
.agent-cell-avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--blue); font-size: 12px; font-weight: 700; }
.agent-cell strong { display: block; font-size: 12px; }
.agent-cell span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-size: 12px; }
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-dot.paused { color: var(--muted); }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 320px; padding: 12px 15px; border: 1px solid rgba(23,32,42,.1); border-radius: 7px; color: #fff; background: #202a35; box-shadow: var(--shadow); font-size: 12px; transform: translateY(12px); opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #b94840; }

.public-page { min-height: 100vh; min-height: 100dvh; height: 100vh; height: 100dvh; display: flex; padding: 22px 18px 18px; overflow: hidden; background: #f5f6f8; }
.public-wrap { width: min(1060px, 100%); margin: 0 auto; }
.public-nav { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-start; gap: 16px; }
.public-brand { display: flex; align-items: center; gap: 10px; }
.public-brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.public-brand .brand-name { font-size: 14px; }
.public-hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); gap: 36px; align-items: end; padding: 90px 0 46px; }
.public-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--blue); font-size: 12px; font-weight: 700; }
.public-kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.public-hero h1 { max-width: 560px; margin: 14px 0 12px; font-size: 52px; letter-spacing: 0; line-height: 1.02; }
.public-hero p { max-width: 500px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.public-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 23px; }
.public-hero-note { align-self: end; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.public-hero-note-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.public-hero-note strong { display: block; margin-top: 10px; font-size: 18px; letter-spacing: 0; }
.public-hero-note p { margin-top: 7px; font-size: 12px; line-height: 1.6; }
.public-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 14px; align-items: start; }
.public-chat-card { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.public-chat-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.public-chat-head #reset-chat { flex: 0 0 auto; white-space: nowrap; }
.public-chat-agent { display: flex; align-items: center; gap: 10px; }
.public-chat-agent .preview-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
.public-chat-name { font-size: 13px; font-weight: 700; }
.public-chat-status { margin-top: 3px; color: var(--green); font-size: 12px; }
.public-chat-body { min-height: 410px; display: flex; flex-direction: column; gap: 12px; padding: 18px; background: #fbfcfd; }
.message { width: fit-content; max-width: 82%; align-self: flex-start; padding: 11px 12px; border-radius: 5px 11px 11px 11px; color: #3f4a58; background: var(--surface); box-shadow: var(--shadow-soft); font-size: 12px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; border-radius: 11px 5px 11px 11px; color: #fff; background: var(--blue); }
.message .message-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; white-space: normal; }
.message.user .message-meta { color: rgba(255,255,255,.72); }
.message.thinking { min-width: 56px; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.thinking-indicator { height: 16px; display: inline-flex; align-items: center; gap: 4px; }
.thinking-indicator > span { width: 5px; height: 5px; border-radius: 50%; background: #8b95a3; animation: thinking-bounce 1.15s ease-in-out infinite; }
.thinking-indicator > span:nth-child(2) { animation-delay: .14s; }
.thinking-indicator > span:nth-child(3) { animation-delay: .28s; }
.context-notice { padding: 8px 18px; color: var(--muted); background: #f5f7fa; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.chat-form { display: flex; flex: 0 0 auto; align-items: flex-end; gap: 8px; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.chat-form .textarea { min-height: 42px; max-height: 110px; padding: 11px 12px; resize: none; }
.chat-form .button { min-height: 42px; padding: 0 13px; }
.chat-form .chat-action { width: 42px; min-width: 42px; padding: 0; }
.chat-form .chat-action.is-stop { border-color: var(--ink); border-radius: 50%; background: var(--ink); box-shadow: none; }
.chat-form .chat-action.is-stop:hover { transform: none; background: #293440; }
.public-side { display: grid; gap: 14px; }
.public-side .card { padding: 18px; }
.public-side h2 { margin: 0; font-size: 14px; }
.public-side p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.public-announcement { border-left: 3px solid var(--coral); background: var(--coral-soft) !important; }
.public-announcement h2 { color: #94463d; }
.public-ad { color: #fff; background: var(--ink) !important; }
.public-ad p { color: #c6ced7; }
.public-ad .button { margin-top: 15px; color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); }
.public-marquee { display: flex; align-items: flex-start; gap: 8px; }
.public-marquee .icon { color: var(--coral); }
.public-empty { min-height: 55vh; display: grid; place-items: center; text-align: center; }

@media (max-width: 1040px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .settings-grid, .kb-layout { grid-template-columns: 1fr; }
  .phone-wrap, .test-panel { position: static; }
  .phone-wrap { display: block; padding: 22px; }
  .phone { margin: 0 auto; }
}
@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar { min-height: auto; padding: 13px 13px 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { padding: 0 2px; }
  .sidebar-section, .sidebar-spacer, .agent-mini, .sidebar-footer { display: none; }
  .nav { display: flex; gap: 4px; margin-top: 12px; overflow-x: auto; padding-bottom: 2px; }
  .nav-button { width: auto; flex: 0 0 auto; padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .main { padding: 19px 14px 35px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 19px; }
  .topbar-actions { width: 100%; }
  .agent-picker { flex: 1; }
  .page-title { font-size: 24px; }
  .view-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .view-head-actions { width: 100%; }
  .view-head-actions .button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .form-grid .field + .field { margin-top: 15px; }
  .card-pad, .section-card { padding: 16px; }
  .public-page { padding: 14px 12px 35px; }
  .public-hero { grid-template-columns: 1fr; gap: 20px; padding: 67px 0 34px; }
  .public-hero h1 { font-size: 36px; }
  .public-hero p { font-size: 13px; }
  .public-columns { grid-template-columns: 1fr; }
  .public-chat-body { min-height: 350px; }
  .agents-table { min-width: 680px; }
  .table-scroll { overflow-x: auto; }
}

.announcement-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(23,32,42,.38); }
.announcement-dialog { width: min(360px, 100%); padding: 24px; border: 1px solid rgba(255,255,255,.7); border-radius: 8px; background: var(--surface); box-shadow: 0 18px 50px rgba(23,32,42,.2); text-align: center; }
.announcement-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--coral); background: var(--coral-soft); }
.announcement-icon .icon { width: 20px; height: 20px; }
.announcement-dialog h2 { margin: 0; font-size: 18px; }
.announcement-dialog p { margin: 12px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.settings-overlay { position: fixed; inset: 0; z-index: 21; display: grid; place-items: center; padding: 20px; background: rgba(23,32,42,.38); overflow-y: auto; }
.settings-dialog { width: min(560px, 100%); padding: 22px; border: 1px solid rgba(255,255,255,.7); border-radius: 8px; background: var(--surface); box-shadow: 0 18px 50px rgba(23,32,42,.2); }
.settings-dialog [hidden] { display: none !important; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.public-marquee-window { min-width: 0; overflow: hidden; }
.public-marquee-track { width: max-content; white-space: nowrap; animation: public-marquee-scroll 18s linear infinite; }
.public-disclosure { max-width: 720px; flex: 0 0 auto; margin: 18px auto 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
@keyframes public-marquee-scroll { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
@keyframes thinking-bounce { 0%, 60%, 100% { opacity: .38; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .public-marquee-track { animation: none; transform: none; }
  .thinking-indicator > span { animation: none; opacity: .62; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Compact information hierarchy for the host-based public workspace. */
.public-clean { width: min(920px, 100%); min-height: 0; display: flex; flex: 1 1 auto; flex-direction: column; padding-top: 4px; }
.public-context { margin-top: 2px; color: var(--muted); font-size: 12px; }
.public-announcement { display: flex; align-items: center; gap: 9px; margin-top: 18px; padding: 10px 12px; border: 1px solid #ffd9d3; border-radius: 7px; color: #8d4a42; background: var(--coral-soft); }
.public-announcement .icon { color: var(--coral); }
.public-announcement p { margin: 0; font-size: 12px; line-height: 1.5; }
.public-clean .public-chat-card { min-height: 0; flex: 1 1 auto; margin-top: 16px; }
.public-clean .public-chat-body { min-height: 0; max-height: none; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.public-clean .public-chat-body.has-messages { min-height: 0; }
.public-empty-prompt { display: grid; place-items: center; gap: 8px; min-height: 220px; padding: 22px; color: var(--muted); text-align: center; }
.public-empty-prompt strong { color: var(--ink); font-size: 16px; }
.public-empty-prompt p { max-width: 500px; margin: 0; font-size: 12px; line-height: 1.6; }
.public-empty-prompt .preview-chips { justify-content: center; padding: 4px 0 0; }
.public-clean .public-marquee { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; margin-top: 12px; padding: 0 3px; color: var(--muted); }
.public-clean .public-marquee p { margin: 0; font-size: 12px; }
.public-recommendation { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 18px; margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.public-recommendation-label { color: var(--blue); font-size: 12px; font-weight: 700; }
.public-recommendation h2 { margin: 4px 0 0; font-size: 14px; }
.public-recommendation p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.domain-input { display: flex; align-items: center; gap: 7px; }
.domain-input .input { min-width: 0; }
.domain-input span { flex: 0 0 auto; color: var(--muted); font-size: 13px; }
.public-url { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin-top: 17px; padding: 10px; border-radius: 7px; background: var(--surface-soft); }
.public-url strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.helper-text { display: block; font-size: 12px; line-height: 1.55; }
.compact-settings .section-card { min-height: 100%; }
.domain-list { display: grid; gap: 8px; }
.domain-list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.7); }
.domain-list-row strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.domain-list-row span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.domain-add-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .public-page { height: 100dvh; padding: 10px 8px max(10px, env(safe-area-inset-bottom)); }
  .public-clean { min-height: 0; padding-top: 0; }
  .public-clean .public-chat-card { min-height: 0; margin-top: 10px; }
  .public-clean .public-chat-body, .public-clean .public-chat-body.has-messages { min-height: 0; max-height: none; }
  .public-chat-head { padding: 13px; }
  .public-disclosure { margin-top: 10px; }
  .public-recommendation { align-items: flex-start; flex-direction: column; gap: 11px; }
  .public-recommendation .button { width: 100%; }
  .public-url { grid-template-columns: 1fr auto; }
  .public-url .status-dot { grid-column: 1 / -1; }
}

/* Operational dashboards and multi-provider routing workspace. */
body.modal-open { overflow: hidden; }
.usage-panel { margin-top: 14px; overflow: hidden; }
.usage-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.usage-panel-head h2 { margin: 0; font-size: 14px; }
.usage-panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.usage-report-status { flex: 0 0 auto; padding: 5px 8px; border-radius: 5px; color: var(--amber); background: var(--amber-soft); font-size: 12px; font-weight: 700; }
.usage-report-status.reported { color: var(--green); background: var(--green-soft); }
.usage-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.usage-metric { min-width: 0; padding: 14px 16px; border-left: 1px solid var(--line); }
.usage-metric:first-child { border-left: 0; }
.usage-metric span { display: block; color: var(--muted); font-size: 12px; }
.usage-metric strong { display: block; margin-top: 6px; overflow-wrap: anywhere; font-size: 14px; }
.agent-health-list { display: grid; }
.agent-health-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-top: 1px solid var(--line); }
.agent-health-row:first-child { padding-top: 0; border-top: 0; }
.agent-health-meta { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.access-stack { display: grid; gap: 14px; }
.access-stack .usage-panel { margin-top: 0; }
.domain-compact { padding: 17px 18px; }
.domain-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.domain-summary h2, .channel-pool-head h2 { margin: 0; font-size: 15px; }
.domain-summary p, .channel-pool-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.domain-summary .public-url { width: min(450px, 48%); margin: 0; }
.domain-compact-form { display: grid; grid-template-columns: minmax(280px, 1fr) auto; align-items: end; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.domain-compact-form .field { max-width: 620px; }
.channel-pool { overflow: hidden; }
.channel-pool-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; }
.routing-toolbar { display: grid; grid-template-columns: minmax(190px, 1fr) auto auto auto auto; align-items: center; gap: 10px 18px; padding: 12px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfd; }
.routing-copy { display: grid; gap: 3px; }
.routing-strategy { font-size: 12px; font-weight: 700; }
.routing-copy small { color: var(--muted); font-size: 12px; }
.routing-switch { display: flex; align-items: center; gap: 9px; color: #586273; font-size: 12px; font-weight: 700; white-space: nowrap; }
.routing-attempts { display: flex; align-items: center; gap: 8px; color: #586273; font-size: 12px; font-weight: 700; white-space: nowrap; }
.routing-attempts .input { width: 58px; padding: 7px 8px; }
.channel-list-head, .channel-row { display: grid; grid-template-columns: minmax(230px, 1.55fr) minmax(135px, .65fr) minmax(120px, .55fr) auto; align-items: center; gap: 18px; }
.channel-list-head { padding: 10px 18px; color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 700; }
.channel-row { min-height: 82px; padding: 13px 18px; border-top: 1px solid var(--line); }
.channel-row:first-child { border-top: 0; }
.channel-identity { min-width: 0; display: grid; gap: 4px; }
.channel-name-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.channel-name-line strong { font-size: 13px; }
.channel-identity > span, .channel-identity > small { min-width: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.channel-schedule { display: flex; flex-wrap: wrap; gap: 5px; }
.channel-schedule span { padding: 5px 7px; border-radius: 5px; color: var(--muted); background: var(--surface-soft); font-size: 12px; white-space: nowrap; }
.channel-schedule strong { color: var(--ink); }
.channel-usage { display: grid; gap: 4px; font-size: 12px; }
.channel-usage span { color: var(--muted); font-size: 12px; }
.channel-actions { flex-wrap: nowrap; }
.channel-delete { color: #b63c35; }
.status-dot.warning { color: var(--amber); }
.channel-empty { gap: 8px; padding: 32px 18px; }
.channel-empty span { color: var(--muted); }
.agents-panel .card-title { margin-bottom: 17px; }
.table-domain { overflow-wrap: anywhere; }
.table-subline { display: block; max-width: 360px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-cell { display: block; max-width: 330px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.registry-panel { margin-top: 14px; }
.workspace-link { display: inline-flex; max-width: 320px; align-items: center; gap: 5px; color: var(--blue); font-weight: 700; text-decoration: none; }
.workspace-link:hover { text-decoration: underline; }
.textarea-compact { min-height: 78px; }

.workspace-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.workspace-summary > div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.workspace-summary span, .workspace-summary small { display: block; color: var(--muted); font-size: 12px; }
.workspace-summary strong { display: block; margin: 7px 0 4px; overflow-wrap: anywhere; font-size: 14px; }
.workspace-domain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.workspace-domain-grid a { position: relative; min-width: 0; display: grid; gap: 5px; padding: 12px 38px 12px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: rgba(255,255,255,.72); text-decoration: none; }
.workspace-domain-grid a:hover { border-color: rgba(0,113,227,.35); background: #fff; }
.workspace-domain-grid a span { color: var(--muted); font-size: 12px; }
.workspace-domain-grid a strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-domain-grid a .icon { position: absolute; top: 50%; right: 12px; color: var(--blue); transform: translateY(-50%); }
.detail-list { display: grid; }
.detail-list > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.detail-list > div:first-child { padding-top: 0; border-top: 0; }
.detail-list strong, .detail-list span { display: block; }
.detail-list > div > div > span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.workspace-kb-list { display: grid; gap: 8px; }
.workspace-kb-list article { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.72); }
.workspace-kb-list article > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.workspace-kb-list article p { margin: 7px 0; color: #626d7b; font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.workspace-kb-list article small { color: var(--muted); font-size: 12px; }
.compact-empty { min-height: 72px; }

.settings-overlay { align-items: center; overscroll-behavior: contain; }
.settings-dialog { max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.settings-dialog-wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 19px 20px 15px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.modal-body { min-height: 0; padding: 19px 20px; overflow-y: auto; }
.modal-footer { display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfcfd; }
.modal-footer-split { justify-content: space-between; }
.modal-footer-actions { display: flex; gap: 9px; }
.modal-section + .modal-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal-section h3 { margin: 0 0 14px; font-size: 12px; }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Apple-inspired surface pass: calm canvas, clear hierarchy, immediate feedback. */
:root {
  --canvas: #f5f5f7;
  --surface: rgba(255, 255, 255, .92);
  --surface-soft: #eef0f3;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, .11);
  --blue: #0071e3;
  --blue-soft: #eaf3ff;
  --green: #248a5a;
  --green-soft: #e9f7ef;
  --coral: #d95d50;
  --coral-soft: #fff0ed;
  --amber: #a66b00;
  --amber-soft: #fff5dc;
  --shadow: 0 18px 44px rgba(29, 29, 31, .09);
  --shadow-soft: 0 6px 18px rgba(29, 29, 31, .06);
  --radius: 10px;
}

body { color: var(--ink); background: var(--canvas); }
button, .button, .nav-button, .preview-chip, .switch-track { -webkit-tap-highlight-color: transparent; }
.button { transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease, background-color .18s ease; }
.button:active, .preview-chip:active, .nav-button:active { transform: none; }
.button-primary { box-shadow: 0 5px 12px rgba(0, 113, 227, .2); }
.button-primary:hover { background: #0077ed; box-shadow: 0 8px 18px rgba(0, 113, 227, .24); }
.button-secondary:hover { border-color: rgba(0, 113, 227, .3); color: var(--blue); background: #fbfdff; }
.input, .textarea, .select { border-color: rgba(29, 29, 31, .14); background: rgba(255,255,255,.96); }
.input::placeholder, .textarea::placeholder { color: #a1a1a6; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(0, 113, 227, .68); box-shadow: 0 0 0 4px rgba(0, 113, 227, .12); }

.login-screen { background: #f5f5f7; }
.login-wrap { width: min(390px, 100%); }
.brand-lockup { margin-bottom: 24px; }
.brand-mark { border-radius: 12px; background: #1d1d1f; box-shadow: 0 8px 18px rgba(29,29,31,.16); }
.login-card { border-color: rgba(29,29,31,.1); border-radius: 12px; box-shadow: 0 22px 60px rgba(29,29,31,.1); }
.login-card h1 { letter-spacing: 0; }

.admin-shell { background: var(--canvas); }
.sidebar { position: sticky; top: 0; height: 100vh; border-right-color: rgba(29,29,31,.08); background: rgba(250,250,252,.78); backdrop-filter: blur(22px) saturate(150%); }
.sidebar-brand .brand-mark { background: #1d1d1f; }
.sidebar-section { color: #98989d; letter-spacing: .06em; }
.nav-button { border-radius: 9px; color: #6e6e73; }
.nav-button:hover { background: rgba(29,29,31,.06); }
.nav-button.active { color: #005fc7; background: rgba(0,113,227,.1); }
.agent-mini { border-color: rgba(29,29,31,.1); background: rgba(255,255,255,.72); box-shadow: none; }
.main { max-width: none; width: 100%; margin: 0 auto; padding-top: 31px; }
.topbar { position: sticky; top: 0; z-index: 5; margin: -31px -52px 26px; padding: 27px 52px 17px; border-bottom: 1px solid rgba(29,29,31,.06); background: rgba(245,245,247,.78); backdrop-filter: blur(20px) saturate(145%); }
.page-title { letter-spacing: 0; }
.page-subtitle { color: #86868b; }
.card, .stat-card { border-color: rgba(29,29,31,.1); background: var(--surface); box-shadow: var(--shadow-soft); }
.card { overflow: clip; }
.stat-card { min-height: 126px; }
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease; }
.stat-icon { border-radius: 9px; }
.card-title h2, .section-card h2 { letter-spacing: 0; }
.preview-card { background: #f2f3f5; }
.preview-top, .phone-header { background: rgba(255,255,255,.82); }
.kb-item, .test-result { border-color: rgba(29,29,31,.1); }
.kb-item:hover { border-color: rgba(0,113,227,.35); box-shadow: 0 8px 22px rgba(0,113,227,.08); }
.tag, .channel-schedule span { background: #f1f2f4; }
.usage-panel-head, .channel-pool-head { background: rgba(255,255,255,.5); }
.routing-toolbar, .channel-list-head { background: #f6f6f8; }
.modal-head, .modal-footer { background: rgba(250,250,252,.86); }

.public-page { padding-top: 16px; background: #f5f5f7; }
.public-clean { max-width: 940px; }
.public-nav { min-height: 42px; }
.public-brand .brand-mark { border-radius: 11px; background: #1d1d1f; }
.public-chat-card { border-color: rgba(29,29,31,.1); border-radius: 14px; box-shadow: 0 18px 54px rgba(29,29,31,.1); }
.public-chat-head { padding: 16px 20px; background: rgba(255,255,255,.76); backdrop-filter: blur(18px) saturate(140%); }
.public-chat-name { letter-spacing: 0; }
.public-chat-status { color: #248a5a; }
.public-chat-body { padding: 22px; background: #f8f8fa; }
.message { border: 1px solid rgba(29,29,31,.07); border-radius: 7px 15px 15px 15px; box-shadow: 0 5px 14px rgba(29,29,31,.06); }
.message.user { border: 0; border-radius: 15px 7px 15px 15px; background: #0071e3; box-shadow: 0 6px 14px rgba(0,113,227,.18); }
.chat-form { padding: 13px 14px max(13px, env(safe-area-inset-bottom)); background: rgba(255,255,255,.88); backdrop-filter: blur(18px) saturate(140%); }
.chat-form .textarea { border-radius: 11px; background: #f3f3f5; }
.chat-form .chat-action { border-radius: 12px; }
.public-empty-prompt { min-height: 250px; }
.preview-chip { border-color: rgba(29,29,31,.12); background: rgba(255,255,255,.86); }
.preview-chip:hover { border-color: rgba(0,113,227,.35); color: var(--blue); background: #fff; }
.public-recommendation { border-color: rgba(0,113,227,.16); background: #f8fbff; }
.public-disclosure { color: #8e8e93; }

@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .public-chat-head, .chat-form, .modal-footer { background: var(--surface); backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  .card, .stat-card, .input, .textarea, .select, .button-secondary { border-color: #5f6368; }
  .sidebar, .topbar { background: var(--surface); backdrop-filter: none; }
}

@media (max-width: 900px) {
  .topbar { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 1120px) {
  .usage-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .usage-metric:nth-child(4) { border-left: 0; }
  .usage-metric:nth-child(n+4) { border-top: 1px solid var(--line); }
  .routing-toolbar { grid-template-columns: minmax(190px, 1fr) auto auto; }
  .routing-attempts { justify-self: start; }
  .channel-list-head, .channel-row { grid-template-columns: minmax(230px, 1fr) minmax(125px, .55fr) auto; }
  .channel-list-head span:nth-child(3) { display: none; }
  .channel-usage { display: none; }
}

@media (max-width: 760px) {
  .usage-panel-head, .domain-summary, .channel-pool-head { align-items: flex-start; flex-direction: column; }
  .usage-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-metric:nth-child(odd) { border-left: 0; }
  .usage-metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .usage-metric:nth-child(4) { border-left: 1px solid var(--line); }
  .agent-health-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .agent-health-meta { width: 100%; justify-content: space-between; }
  .domain-summary .public-url { width: 100%; }
  .domain-compact-form { grid-template-columns: 1fr; }
  .domain-compact-form .button { width: 100%; }
  .routing-toolbar { grid-template-columns: 1fr 1fr; gap: 13px; }
  .routing-copy { grid-column: 1 / -1; }
  .routing-toolbar > .button { grid-column: 1 / -1; width: 100%; }
  .routing-attempts { justify-self: stretch; justify-content: space-between; }
  .channel-list-head { display: none; }
  .channel-row { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .channel-usage { display: grid; }
  .channel-actions { justify-content: flex-start; flex-wrap: wrap; }
  .agents-table { min-width: 0; }
  .agents-table thead { display: none; }
  .agents-table, .agents-table tbody, .agents-table tr { display: block; width: 100%; }
  .agents-table tr { padding: 13px 0; border-top: 1px solid var(--line); }
  .agents-table tr:first-child { border-top: 0; }
  .agents-table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; border: 0; text-align: right; }
  .agents-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; }
  .agents-table td:first-child { padding-top: 0; }
  .agents-table td:first-child::before { display: none; }
  .agents-table td:first-child .agent-cell { text-align: left; }
  .agents-table .row-actions { flex-wrap: wrap; }
  .workspace-summary, .workspace-domain-grid { grid-template-columns: 1fr; }
  .endpoint-cell, .workspace-link { max-width: 210px; }
  .settings-overlay { align-items: end; padding: 10px; }
  .settings-dialog { width: 100%; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); border-radius: 8px; }
  .modal-head, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
  .modal-footer-split { align-items: stretch; flex-direction: column-reverse; }
  .modal-footer-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-footer-split > div:first-child .button { width: 100%; }
  .form-grid-three { grid-template-columns: 1fr; gap: 0; }
  .form-grid-three .field + .field { margin-top: 15px; }
}

@media (max-width: 760px) {
  .sidebar { position: static; height: auto; }
  .main { padding-top: 19px; }
  .topbar { position: static; margin: -19px -14px 19px; padding: 19px 14px 14px; }
  .public-page { padding-top: 10px; }
}

/* Compact workspace navigation on touch devices. The content remains the
   primary surface while the section switcher stays reachable at the top. */
@media (max-width: 760px) {
  .admin-shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 0;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(29,29,31,.08);
    background: rgba(250,250,252,.86);
    backdrop-filter: blur(22px) saturate(150%);
  }
  .sidebar-brand { padding: 0 2px 9px; }
  .sidebar-section, .sidebar-spacer, #sidebar-agent, .sidebar-footer { display: none; }
  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 1px 0 2px;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-button {
    width: auto;
    min-height: 36px;
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid transparent;
    white-space: nowrap;
  }
  .nav-button.active { border-color: rgba(0,113,227,.12); }
  .main { padding: 19px 14px 36px; }
  .topbar { margin: -19px -14px 19px; }
}

/* Keep type stable across scripts and user text-size settings. */
.page-title, .login-card h1, .public-hero h1, .card-title h2, .section-card h2,
.channel-name-line strong, .stat-value { letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .button:hover, .stat-card:hover { transform: none; }
}

/* Guest workspace: a calm, material-first surface that keeps the question
   composer and conversation in the visual foreground. */
:root {
  --public-ink: #1d1d1f;
  --public-muted: #6e6e73;
  --public-canvas: #f5f5f7;
  --public-surface: rgba(255, 255, 255, .78);
  --public-solid: #ffffff;
  --public-line: rgba(29, 29, 31, .11);
  --public-blue: #0071e3;
}

.public-page {
  min-height: 100dvh;
  height: auto;
  display: block;
  overflow: auto;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  color: var(--public-ink);
  background: var(--public-canvas);
}
.public-wrap.public-clean {
  width: min(1180px, 100%);
  min-height: calc(100dvh - 38px);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.public-nav {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 2px;
  background: rgba(245, 245, 247, .78);
  border-bottom: 1px solid rgba(29, 29, 31, .06);
  backdrop-filter: blur(22px) saturate(160%);
}
.public-brand { min-width: 0; gap: 11px; }
.public-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 5px 12px rgba(29, 29, 31, .13); }
.public-brand .brand-mark .icon { width: 19px; height: 19px; }
.public-brand .brand-name { max-width: 290px; overflow: hidden; color: var(--public-ink); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.public-context { color: var(--public-muted); font-size: 12px; }
.public-nav-actions { display: flex; align-items: center; gap: 12px; }
.public-nav-icon { width: 34px; min-width: 34px; padding: 0 !important; }
.public-nav-text { min-width: max-content; padding-inline: 10px; white-space: nowrap; }
.public-trust { display: inline-flex; align-items: center; gap: 6px; color: var(--public-muted); font-size: 12px; white-space: nowrap; }
.public-trust-dot, .public-live-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52, 199, 89, .14); }
.public-nav .button { color: var(--public-ink); }

.public-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin: 47px 0 25px;
}
.public-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--public-blue); font-size: 12px; font-weight: 700; }
.public-kicker::before { width: 6px; height: 6px; background: currentColor; }
.public-intro h1 { max-width: 720px; margin: 12px 0 9px; color: var(--public-ink); font-size: 52px; font-weight: 700; letter-spacing: 0; line-height: 1.04; }
.public-intro p { max-width: 640px; margin: 0; color: var(--public-muted); font-size: 15px; line-height: 1.65; }
.public-intro-meta { display: inline-flex; align-items: center; gap: 10px; padding-bottom: 7px; color: var(--public-muted); font-size: 12px; white-space: nowrap; }
.public-live { display: inline-flex; align-items: center; gap: 8px; color: var(--public-ink); }
.public-live strong { font-size: 12px; font-weight: 700; }
.public-intro-divider { width: 1px; height: 16px; background: var(--public-line); }

.public-layout { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 16px; align-items: stretch; min-height: 0; flex: 1 1 auto; }
.public-clean .public-chat-card { margin-top: 0; flex: initial; }
.public-chat-card { min-height: 540px; max-height: min(700px, calc(100dvh - 244px)); display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--public-line); border-radius: 8px; background: var(--public-surface); box-shadow: 0 16px 38px rgba(29, 29, 31, .07); backdrop-filter: blur(18px) saturate(140%); }
.public-chat-head { min-height: 72px; padding: 15px 18px; border-bottom: 1px solid var(--public-line); background: rgba(255, 255, 255, .68); }
.public-chat-agent { min-width: 0; gap: 11px; }
.public-chat-agent .preview-avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 17px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.public-chat-name { overflow: hidden; color: var(--public-ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.public-chat-status { display: flex; align-items: center; gap: 2px; margin-top: 4px; color: var(--public-muted); font-size: 12px; }
.public-chat-status .status-dot { color: #34c759; }
.public-chat-count { flex: 0 0 auto; color: var(--public-muted); font-size: 12px; }
.public-chat-body { min-height: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding: 20px 20px 22px; background: rgba(250, 250, 252, .76); scrollbar-gutter: stable; overscroll-behavior: contain; }
.public-chat-body.has-messages { align-content: flex-start; }
.message { max-width: min(76%, 620px); padding: 12px 14px; border: 1px solid rgba(29, 29, 31, .06); border-radius: 5px 12px 12px 12px; color: #3a3a3c; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 12px rgba(29, 29, 31, .06); font-size: 13px; line-height: 1.65; }
.message.user { border-color: transparent; border-radius: 12px 5px 12px 12px; color: #fff; background: var(--public-blue); box-shadow: 0 5px 13px rgba(0, 113, 227, .18); }
.message .message-meta { color: var(--public-muted); }
.message.user .message-meta { color: rgba(255, 255, 255, .72); }
.message.thinking { min-width: 58px; min-height: 42px; }
.context-notice { order: -1; padding: 9px 12px; border: 1px solid rgba(0, 113, 227, .14); border-radius: 7px; color: #4b6581; background: rgba(232, 243, 255, .78); font-size: 12px; line-height: 1.5; }
.public-empty-prompt { min-height: 310px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 28px 18px; color: var(--public-muted); text-align: center; }
.public-empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 3px; border: 1px solid currentColor; border-radius: 13px; background: rgba(255, 255, 255, .72); }
.public-empty-icon .icon { width: 20px; height: 20px; }
.public-empty-prompt strong { color: var(--public-ink); font-size: 18px; font-weight: 700; }
.public-empty-prompt p { max-width: 460px; margin: 0; font-size: 12px; line-height: 1.6; }
.preview-chips { justify-content: center; gap: 8px; margin-top: 8px; padding: 0; }
.preview-chip { min-height: 34px; padding: 0 11px; border: 1px solid rgba(29, 29, 31, .12); border-radius: 17px; color: #4a4a4c; background: rgba(255, 255, 255, .86); font-size: 12px; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.preview-chip:hover { border-color: rgba(0, 113, 227, .35); background: #fff; transform: translateY(-1px); }
.chat-form { padding: 14px 16px 16px; border-top: 1px solid var(--public-line); background: rgba(255, 255, 255, .84); }
.public-composer { position: relative; border: 1px solid rgba(29, 29, 31, .16); border-radius: 8px; background: rgba(255, 255, 255, .94); transition: border-color .18s ease, box-shadow .18s ease; }
.public-composer:focus-within { border-color: rgba(0, 113, 227, .5); box-shadow: 0 0 0 3px rgba(0, 113, 227, .11); }
.public-composer .textarea { min-height: 46px; max-height: 120px; display: block; border: 0; padding: 11px 52px 11px 14px; resize: none; color: var(--public-ink); background: transparent; box-shadow: none; line-height: 1.55; }
.public-composer .textarea:focus { box-shadow: none; }
.public-composer-footer { position: absolute; top: 50%; right: 7px; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--public-muted); font-size: 12px; transform: translateY(-50%); }
.chat-form .chat-action { width: 34px; min-width: 34px; min-height: 34px; border-radius: 50%; padding: 0; }
.chat-form .chat-action.is-stop { border-color: var(--public-ink); background: var(--public-ink); }

.public-aside { display: grid; align-content: start; gap: 12px; }
.public-aside-block { padding: 18px; border: 1px solid var(--public-line); border-radius: 8px; background: var(--public-surface); box-shadow: 0 8px 24px rgba(29, 29, 31, .045); backdrop-filter: blur(18px) saturate(140%); }
.public-aside-label { margin-bottom: 12px; color: var(--public-muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.public-topic-list { display: grid; }
.public-topic { min-height: 47px; display: grid; grid-template-columns: 22px minmax(0, 1fr) 15px; align-items: center; gap: 8px; border: 0; border-top: 1px solid var(--public-line); padding: 8px 0; color: var(--public-ink); background: transparent; font-size: 12px; text-align: left; }
.public-topic:first-child { border-top: 0; padding-top: 0; }
.public-topic:last-child { padding-bottom: 0; }
.public-topic:hover { color: var(--public-blue); }
.public-topic .icon { color: var(--public-muted); transition: transform .18s ease; }
.public-topic:hover .icon { transform: translateX(2px); }
.public-topic-index { color: #a1a1a6; font-size: 12px; font-variant-numeric: tabular-nums; }
.public-aside-note { color: var(--public-muted); }
.public-status-line { display: flex; align-items: center; gap: 8px; color: var(--public-ink); font-size: 12px; }
.public-status-line strong { font-weight: 700; }
.public-status-line > span:last-child { margin-left: auto; color: var(--public-muted); font-size: 12px; }
.public-aside-note p { margin: 13px 0 0; color: var(--public-muted); font-size: 12px; line-height: 1.65; }
.public-disclosure { max-width: 760px; margin: 17px auto 3px; color: #8a8a90; font-size: 12px; line-height: 1.6; text-align: center; }
.public-recommendation { margin-top: 2px; padding: 14px 16px; border: 1px solid var(--public-line); border-radius: 8px; background: rgba(255, 255, 255, .88); }
.public-recommendation h2 { color: var(--public-ink); }
.public-clean .public-marquee { margin-top: 2px; padding-top: 5px; color: var(--public-muted); }
.public-marquee .icon { color: var(--public-blue); }

.announcement-overlay { background: rgba(29, 29, 31, .28); backdrop-filter: blur(10px); }
.announcement-dialog { width: min(390px, 100%); padding: 28px; border: 1px solid rgba(255, 255, 255, .72); border-radius: 8px; background: rgba(255, 255, 255, .92); box-shadow: 0 22px 60px rgba(29, 29, 31, .22); backdrop-filter: blur(24px) saturate(140%); }
.announcement-icon { width: 44px; height: 44px; margin-bottom: 16px; border-radius: 14px; color: var(--public-blue); background: rgba(0, 113, 227, .1); }
.announcement-eyebrow { margin: 0 0 7px !important; color: var(--public-blue) !important; font-size: 12px !important; font-weight: 700; }
.announcement-dialog h2 { color: var(--public-ink); font-size: 20px; }
.announcement-dialog > p:not(.announcement-eyebrow) { color: var(--public-muted); }
.public-complaint-button { min-height: 34px; gap: 6px; color: var(--public-muted); }
.public-complaint-button:hover { color: var(--public-blue); background: rgba(0, 113, 227, .07); }
.complaint-dialog { width: min(520px, 100%); }
.complaint-dialog .textarea { min-height: 120px; resize: vertical; }
.complaint-table td:nth-child(2) { min-width: 280px; white-space: normal; }
.complaint-table td:nth-child(3) { min-width: 230px; white-space: normal; }
.complaint-content { display: block; margin: 6px 0 9px; color: var(--muted); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.complaint-row-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.complaint-detail-dialog { width: min(620px, 100%); }
.complaint-detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 0; }
.complaint-detail-list > div { min-width: 0; }
.complaint-detail-list dt { color: var(--muted); font-size: var(--type-label); font-weight: 600; }
.complaint-detail-list dd { margin: 6px 0 0; color: var(--ink); font-size: var(--type-body); line-height: 1.65; overflow-wrap: anywhere; }
.complaint-detail-list dd span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--type-caption); }
.complaint-detail-full { grid-column: 1 / -1; }
.complaint-detail-full dd { white-space: pre-wrap; }
.complaint-status { min-width: 108px; min-height: 34px; padding-top: 6px; padding-bottom: 6px; }

@media (max-width: 940px) {
  .public-layout { grid-template-columns: 1fr; }
  .public-chat-card { max-height: none; }
  .public-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .public-page { padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .public-wrap.public-clean { min-height: calc(100dvh - 20px); }
  .public-nav { min-height: 53px; padding: 6px 1px; }
  .public-nav-actions { gap: 7px; }
	.public-complaint-button { min-width: 36px; padding: 0 8px; }
	.public-complaint-button span { display: none; }
  .public-trust { display: none; }
  .public-intro { align-items: flex-start; flex-direction: column; gap: 13px; margin: 31px 0 18px; }
  .public-intro h1 { margin-top: 10px; font-size: 38px; line-height: 1.08; }
  .public-intro p { font-size: 13px; }
  .public-intro-meta { padding-bottom: 0; }
  .public-chat-card { min-height: 570px; border-radius: 8px; }
  .public-chat-head { min-height: 68px; padding: 13px; }
  .public-chat-body { min-height: 340px; padding: 16px 13px 18px; }
  .public-empty-prompt { min-height: 280px; padding: 22px 8px; }
  .public-empty-prompt strong { font-size: 17px; }
  .message { max-width: 88%; font-size: 13px; }
  .chat-form { padding: 11px 11px max(11px, env(safe-area-inset-bottom)); }
  .public-aside { grid-template-columns: 1fr; }
  .public-aside-block { padding: 15px; }
  .public-disclosure { margin-top: 13px; }
}

@media (prefers-reduced-transparency: reduce) {
  .public-page, .public-nav, .public-chat-card, .public-chat-head, .public-chat-body, .chat-form, .public-aside-block, .announcement-dialog { background: var(--public-solid); backdrop-filter: none; }
}

/* Phone-first guest surface. The conversation owns the viewport; secondary
   information yields to the composer and returns below the fold on desktop. */
@media (max-width: 760px) {
  html.public-mode, body.public-mode { height: 100%; overflow: hidden; }
  .public-page {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding: 0;
    overscroll-behavior: none;
  }
  .public-wrap.public-clean {
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .public-nav {
    position: relative;
    min-height: 60px;
    padding: max(9px, env(safe-area-inset-top)) 15px 9px;
    background: rgba(245, 245, 247, .82);
    border-bottom: 1px solid rgba(29, 29, 31, .08);
    backdrop-filter: blur(22px) saturate(160%);
  }
  .public-brand .brand-mark { width: 34px; height: 34px; border-radius: 11px; }
  .public-brand .brand-name { max-width: 180px; font-size: 13px; }
  .public-context { font-size: 12px; }
  .public-nav .button { min-height: 34px; padding: 0 9px; font-size: 12px; }
  .public-nav .button .icon { width: 15px; height: 15px; }
  .public-intro { display: none; }
  .public-layout {
    display: block;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
  .public-clean .public-chat-card,
  .public-chat-card {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
  }
  .public-chat-head {
    min-height: 58px;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(29, 29, 31, .07);
    background: rgba(255, 255, 255, .54);
  }
  .public-chat-agent { gap: 9px; }
  .public-chat-agent .preview-avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 14px; }
  .public-chat-name { max-width: 210px; font-size: 12px; }
  .public-chat-status { margin-top: 2px; font-size: 12px; }
  .public-chat-count { font-size: 12px; }
  .public-chat-body,
  .public-clean .public-chat-body,
  .public-clean .public-chat-body.has-messages {
    min-height: 0;
    height: auto;
    padding: 16px 15px 18px;
    gap: 10px;
    background: transparent;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .public-chat-body::-webkit-scrollbar { display: none; }
  .context-notice { flex: 0 0 auto; font-size: 12px; }
  .message { max-width: 88%; padding: 10px 12px; border-radius: 5px 13px 13px 13px; font-size: 13px; line-height: 1.62; }
  .message.user { border-radius: 13px 5px 13px 13px; }
  .public-empty-prompt {
    min-height: 0;
    flex: 1 0 250px;
    justify-content: center;
    gap: 8px;
    padding: 20px 0 8px;
  }
  .public-empty-icon { width: 38px; height: 38px; border-radius: 12px; }
  .public-empty-prompt strong { font-size: 16px; }
  .public-empty-prompt p { max-width: 290px; font-size: 12px; line-height: 1.55; }
  .preview-chips { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 7px; }
  .preview-chip { min-height: 48px; display: grid; place-items: center; padding: 6px 5px; border-radius: 12px; font-size: 12px; line-height: 1.35; }
  .public-clean .public-marquee { margin-top: 0; padding: 3px 0 0; font-size: 12px; }
  .public-recommendation { flex-direction: column; align-items: flex-start; gap: 9px; margin-top: 1px; padding: 12px; }
  .public-recommendation .button { width: 100%; }
  .chat-form {
    position: relative;
    z-index: 2;
    padding: 9px 12px max(11px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(29, 29, 31, .09);
    background: rgba(245, 245, 247, .84);
    backdrop-filter: blur(22px) saturate(160%);
  }
  .public-composer { border-radius: 14px; background: rgba(255, 255, 255, .94); }
  .public-composer .textarea { min-height: 42px; max-height: 100px; padding: 9px 48px 9px 12px; font-size: 14px; }
  .public-composer-footer { right: 5px; font-size: 12px; }
  .chat-form .chat-action { width: 33px; min-width: 33px; min-height: 33px; }
  .public-aside, .public-disclosure { display: none; }
  .announcement-overlay { padding: 16px; }
  .announcement-dialog { padding: 24px 20px; }
	.complaint-dialog { max-height: calc(100dvh - 20px); border-radius: 8px 8px 0 0; }
	.complaint-detail-list { grid-template-columns: 1fr; }
	.complaint-detail-full { grid-column: auto; }
  .button, .preview-chip, .public-topic { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .button:active, .preview-chip:active, .public-topic:active { transform: none; transition: transform 100ms ease-out; }
}

@media (max-width: 360px) {
  .public-brand .brand-name { max-width: 145px; }
  .public-chat-name { max-width: 165px; }
  .public-chat-status span:last-child { display: none; }
  .preview-chips { gap: 5px; }
  .preview-chip { font-size: 12px; }
}

.quick-question-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

@media (min-width: 761px) {
  .public-page { min-height: 100dvh; height: 100dvh; padding: 0; overflow: hidden; }
  .public-wrap.public-clean { width: 100%; min-height: 100dvh; height: 100dvh; }
  .public-nav { padding: 10px 32px; }
  .public-layout { width: 100%; min-height: 0; padding: 0 32px; }
  .public-clean .public-chat-card,
  .public-chat-card { min-height: 0; height: 100%; max-height: none; }
  .public-disclosure { margin: 10px auto 12px; }
}

@media (max-width: 760px) {
  .quick-question-grid { grid-template-columns: 1fr; }
}

.public-avatar-image { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.public-brand .brand-mark.has-image { overflow: hidden; padding: 0; }
.public-action-toolbar { display: flex; align-items: center; gap: 8px; overflow-x: auto; margin-bottom: 9px; scrollbar-width: none; }
.public-action-toolbar::-webkit-scrollbar { display: none; }
.public-action-button { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; border: 1px solid rgba(29, 29, 31, .12); border-radius: 8px; padding: 0 10px; color: var(--public-ink); background: rgba(255, 255, 255, .82); font-size: 12px; text-decoration: none; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.public-action-button:hover { border-color: rgba(0, 113, 227, .32); background: #fff; transform: translateY(-1px); }
.public-action-button:active { transform: none; }
.public-action-button .icon { width: 14px; height: 14px; color: var(--public-blue); }
.public-composer { width: 100%; }
.public-media-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(29, 29, 31, .42); backdrop-filter: blur(12px); }
.public-media-dialog { position: relative; width: min(520px, 100%); max-height: min(720px, 92dvh); display: grid; place-items: center; gap: 10px; padding: 22px; border: 1px solid rgba(255, 255, 255, .72); border-radius: 8px; background: rgba(255, 255, 255, .94); box-shadow: 0 22px 60px rgba(29, 29, 31, .22); }
.public-media-dialog p { width: 100%; margin: 0; color: var(--public-ink); font-size: 13px; font-weight: 700; text-align: center; }
.public-media-dialog img { max-width: 100%; max-height: calc(92dvh - 90px); object-fit: contain; border-radius: 5px; }
.public-media-close { position: absolute; top: 8px; right: 8px; z-index: 1; min-height: 32px; width: 32px; padding: 0; }
.assistant-actions-editor { display: grid; gap: 8px; }
.assistant-action-row { display: grid; grid-template-columns: minmax(110px, .6fr) minmax(120px, .65fr) minmax(0, 1.4fr); gap: 8px; }
.assistant-avatar-upload { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.assistant-avatar-upload .input { min-width: 0; }
.assistant-avatar-upload button { flex: 0 0 auto; }
.assistant-avatar-upload #assistant-avatar-file-name { min-width: 0; flex: 1 1 auto; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-action-upload { min-height: 36px; display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.assistant-action-upload[hidden] { display: none !important; }
.assistant-action-upload > span { min-width: 0; flex: 1 1 auto; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-action-upload .button { flex: 0 0 auto; }
.records-panel { min-width: 0; }
.records-table td { vertical-align: top; }
.record-device { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-record-list { display: grid; gap: 10px; }
.chat-record { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.chat-record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.chat-record-head strong { display: block; color: var(--ink); font-size: 12px; }
.chat-record-head span { display: block; margin-top: 4px; }
.chat-record-question { margin-top: 14px; color: var(--ink); font-size: 13px; font-weight: 700; line-height: 1.6; }
.chat-record-answer { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.chat-conversation-list { display: grid; border-top: 1px solid var(--line); }
.chat-conversation-row { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 15px 2px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; }
.chat-conversation-row:hover { background: var(--surface-soft); }
.chat-conversation-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #344054; font-size: var(--type-body); font-weight: 700; }
.chat-conversation-copy { min-width: 0; display: grid; gap: 2px; }
.chat-conversation-copy strong { font-size: var(--type-body); font-weight: 600; }
.chat-conversation-copy > span { overflow: hidden; color: var(--body-text); font-size: var(--type-body); text-overflow: ellipsis; white-space: nowrap; }
.chat-conversation-copy small { color: var(--muted); font-size: var(--type-caption); line-height: 1.5; }
.chat-conversation-meta { display: grid; justify-items: end; gap: 7px; }
.chat-conversation-meta time { color: var(--muted); font-size: var(--type-caption); font-variant-numeric: tabular-nums; }
.chat-conversation-head-actions { display: flex; align-items: center; gap: 8px; }
.chat-conversation-dialog { width: min(760px, 100%); }
.chat-conversation-messages { min-height: 260px; max-height: min(52vh, 560px); display: grid; align-content: start; gap: 12px; padding: 4px 2px 18px; overflow-y: auto; }
.chat-conversation-message { min-width: 0; max-width: min(82%, 560px); display: grid; gap: 4px; justify-self: start; }
.chat-conversation-message.assistant { justify-self: end; }
.chat-conversation-message > span, .chat-conversation-message time { color: var(--muted); font-size: var(--type-caption); }
.chat-conversation-message.assistant > span, .chat-conversation-message.assistant time { text-align: right; }
.chat-conversation-message p { margin: 0; padding: 10px 12px; border-radius: 8px; color: var(--ink); background: var(--surface-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-conversation-message.assistant p { color: #fff; background: #005fc7; }
.chat-manual-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.chat-manual-form .field { margin: 0; }
.chat-manual-form .textarea { min-height: 82px; }
.chat-offline-note { padding: 13px 0 2px; border-top: 1px solid var(--line); color: var(--body-text); font-size: var(--type-body); }

@media (min-width: 761px) {
  .public-layout { grid-template-columns: 1fr; }
  .public-aside { display: none; }
  .public-action-toolbar { min-height: 34px; }
  .chat-form { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .chat-conversation-row { grid-template-columns: 38px minmax(0, 1fr); }
  .chat-conversation-avatar { width: 38px; height: 38px; }
  .chat-conversation-meta { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: space-between; }
  .chat-manual-form { grid-template-columns: 1fr; }
  .chat-manual-form .button { width: 100%; }
  .assistant-action-row { grid-template-columns: 1fr; }
  .assistant-avatar-upload { align-items: stretch; flex-direction: column; }
  .assistant-avatar-upload button { width: 100%; }
  .public-action-toolbar { margin-bottom: 7px; }
  .public-action-button { min-height: 32px; font-size: 12px; }
}

@media (prefers-reduced-transparency: reduce) {
  .public-action-button, .public-media-dialog { background: var(--public-solid); backdrop-filter: none; }
}

.public-history-overlay { position: fixed; inset: 0; z-index: 35; display: flex; justify-content: flex-end; background: rgba(29, 29, 31, .24); backdrop-filter: blur(8px); }
.public-history-sheet { width: min(360px, 100%); height: 100%; display: flex; flex-direction: column; padding: 22px 18px; border-left: 1px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .92); box-shadow: -18px 0 45px rgba(29, 29, 31, .14); backdrop-filter: blur(24px) saturate(140%); }
.public-history-sheet header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.public-history-eyebrow { margin: 0 0 4px; color: var(--public-muted); font-size: 12px; }
.public-history-sheet h2 { margin: 0; color: var(--public-ink); font-size: 20px; }
.public-history-list { display: grid; gap: 6px; margin-top: 22px; overflow-y: auto; }
.public-history-item { min-height: 55px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; border: 1px solid transparent; border-radius: 8px; padding: 9px 11px; color: var(--public-ink); background: rgba(245, 245, 247, .76); text-align: left; }
.public-history-item:hover, .public-history-item.active { border-color: rgba(0, 113, 227, .2); background: rgba(232, 243, 255, .72); }
.public-history-item-title { width: 100%; overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.public-history-item-time { color: var(--public-muted); font-size: 12px; }

@media (max-width: 760px) {
  .public-history-overlay { align-items: flex-end; }
  .public-history-sheet { width: 100%; height: min(72dvh, 560px); padding: 18px 15px max(18px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .75); border-left: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -18px 45px rgba(29, 29, 31, .16); }
  .public-history-list { margin-top: 16px; }
}

@media (prefers-reduced-transparency: reduce) {
  .public-history-overlay, .public-history-sheet { background: var(--public-solid); backdrop-filter: none; }
}

/* Agent settings are quiet work surfaces: one task per page, stable content
   width, and repeated items only where the data itself repeats. */
.agent-form-page {
  width: 100%;
  margin: 0;
  border-top: 1px solid rgba(29, 29, 31, .1);
}
.agent-form-section { padding: 26px 0 29px; border-bottom: 1px solid rgba(29, 29, 31, .1); }
.agent-form-section-head { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.agent-form-section-head h2 { margin: 0; color: #1d1d1f; font-size: 17px; font-weight: 700; letter-spacing: 0; }
.agent-form-section-head p { max-width: 620px; margin: 5px 0 0; color: #6e6e73; font-size: 12px; line-height: 1.6; }
.agent-form-page > .agent-form-save { display: flex; justify-content: flex-end; padding: 18px 0 4px; }
.agent-form-page .field { max-width: 760px; }
.agent-form-page .form-grid { max-width: 760px; }
.code-input { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.storage-migration-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.storage-settings-page .agent-form-section > .field + .form-grid,
.storage-settings-page .agent-form-section > .form-grid + .form-grid,
.storage-settings-page .agent-form-section > .form-grid + .button { margin-top: 15px; }
.storage-settings-page #storage-active-status { flex: 0 0 auto; white-space: nowrap; }
.storage-migration-flow { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); align-items: center; gap: 10px; }
.storage-migration-flow > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.storage-migration-flow > .icon { color: var(--muted); }
.storage-migration-flow span, .migration-result-grid span { display: block; color: var(--muted); font-size: 12px; }
.storage-migration-flow strong, .migration-result-grid strong { display: block; margin-top: 5px; color: var(--ink); font-size: 13px; }
.storage-migration-note { margin: 13px 0 0; font-size: 12px; line-height: 1.6; }
.migration-result-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; }
.migration-result-grid > div { min-width: 0; padding: 12px; border-left: 1px solid var(--line); }
.migration-result-grid > div:first-child { border-left: 0; }
.settings-avatar { width: 48px; height: 48px; display: grid; flex: 0 0 auto; place-items: center; overflow: hidden; border-radius: 8px; color: #fff; font-size: 19px; font-weight: 700; box-shadow: 0 5px 14px rgba(29,29,31,.12); }
.settings-avatar .public-avatar-image { width: 100%; height: 100%; object-fit: cover; }
.color-control { min-height: 44px; display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; }
.color-control input { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 3px; background: var(--surface); cursor: pointer; }
.quick-question-list { display: grid; gap: 8px; }
.code-textarea { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }

.assistant-actions-editor { display: grid; gap: 12px; }
.assistant-action-row {
  min-width: 0;
  display: block;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(29,29,31,.11);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
}
.assistant-action-row legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.assistant-action-row .field + .field { margin-top: 0; }
.assistant-action-row > .field { max-width: none; margin-top: 14px; }
.assistant-action-row .action-context { margin-top: 14px; padding-bottom: 0; }
.assistant-action-row .action-context[hidden] { display: none !important; }
.assistant-action-row .textarea { min-height: 76px; }

.knowledge-workspace { width: 100%; }
.knowledge-workspace .kb-toolbar { align-items: stretch; margin: 0; padding: 0 0 16px; border-bottom: 1px solid rgba(29,29,31,.1); }
.kb-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.knowledge-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 2px; color: var(--muted); font-size: 12px; }
.knowledge-summary span:first-child { color: var(--ink); font-weight: 700; }
.knowledge-workspace .kb-list { gap: 0; border-top: 1px solid rgba(29,29,31,.08); }
.knowledge-workspace .kb-item { padding: 17px 2px; border: 0; border-bottom: 1px solid rgba(29,29,31,.09); border-radius: 0; background: transparent; }
.knowledge-workspace .kb-item:hover { border-color: rgba(29,29,31,.09); box-shadow: none; }
.knowledge-workspace .kb-answer { max-width: 820px; font-size: 12px; }
.settings-dialog .test-results { max-height: 50dvh; overflow-y: auto; }

.connection-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; }
.connection-metrics > div { min-width: 0; padding: 14px; border-left: 1px solid var(--line); }
.connection-metrics > div:first-child { border-left: 0; }
.connection-metrics span, .connection-answer > span { display: block; color: var(--muted); font-size: 12px; }
.connection-metrics strong { display: block; margin-top: 6px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.connection-answer { margin-top: 14px; padding: 14px; border-radius: 8px; background: #f5f5f7; }
.connection-answer p { margin: 7px 0 0; color: var(--ink); font-size: 12px; line-height: 1.65; white-space: pre-wrap; }

.agent-form-page *, .knowledge-workspace *, .connection-result * { letter-spacing: 0; }

@media (max-width: 760px) {
  .agent-form-page { width: 100%; }
  .agent-form-section { padding: 20px 0 23px; }
  .agent-form-section-head { gap: 14px; margin-bottom: 18px; }
  .agent-form-section-head h2 { font-size: 16px; }
  .agent-form-page > .agent-form-save { padding: 11px 0 max(11px, env(safe-area-inset-bottom)); }
  .agent-form-page > .agent-form-save .button { width: 100%; }
  .assistant-action-row { padding: 14px; }
  .assistant-action-row .form-grid { gap: 0; }
  .assistant-action-row .form-grid .field + .field { margin-top: 14px; }
	.assistant-action-upload { align-items: stretch; flex-direction: column; }
	.assistant-action-upload .button { width: 100%; }
	.storage-settings-page .agent-form-section-head { align-items: flex-start; flex-direction: column; }
	.storage-migration-actions { display: grid; }
	.storage-migration-actions .button { width: 100%; }
	.migration-result-grid { grid-template-columns: 1fr 1fr; }
	.migration-result-grid > div:nth-child(3) { border-left: 0; }
	.migration-result-grid > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .knowledge-workspace .kb-toolbar { display: grid; }
  .kb-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .kb-toolbar-actions .button:last-child { grid-column: 1 / -1; }
  .knowledge-summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .knowledge-workspace .kb-item { padding: 15px 0; }
  .connection-metrics { grid-template-columns: 1fr; }
  .connection-metrics > div { border-top: 1px solid var(--line); border-left: 0; }
  .connection-metrics > div:first-child { border-top: 0; }
}

@media (prefers-reduced-transparency: reduce) {
  .assistant-action-row { background: var(--surface); backdrop-filter: none; }
}

/* The action toolbar is a row above the composer. The legacy chat form flex
   layout would otherwise make the composer share its width with the buttons. */
.public-page .chat-form { display: block; }

@media (min-width: 761px) {
  .public-wrap.public-clean { max-width: none; }
}

/* Audit is a work surface, not a decorative card. The toolbar and table use
   the full content column so operators can scan long values without a narrow
   centered panel. */
.records-workspace { width: 100%; min-width: 0; }
.records-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.records-toolbar h2 { margin: 0; color: var(--ink); font-size: 20px; letter-spacing: 0; }
.records-toolbar p { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.records-filters { display: grid; grid-template-columns: minmax(260px, 1.5fr) minmax(130px, .55fr) minmax(130px, .55fr) minmax(150px, .65fr); gap: 10px; align-items: end; padding: 16px 0; border-bottom: 1px solid var(--line); }
.records-filters .search-box { min-width: 0; }
.filter-field { display: grid; gap: 6px; }
.filter-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.records-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; color: var(--muted); font-size: 12px; }
.records-summary span:first-child { color: var(--ink); font-weight: 700; }
.table-sort { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; color: inherit; background: transparent; font: inherit; font-weight: inherit; text-align: left; }
.table-sort:hover { color: var(--blue); }
.table-sort span { min-width: 13px; color: var(--blue); font-size: 12px; }
.audit-table { table-layout: auto; }
.audit-table th, .audit-table td { white-space: nowrap; }
.audit-table td:nth-child(5) { min-width: 260px; white-space: normal; }
.audit-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-ip { color: var(--ink); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 12px; }

@media (max-width: 900px) {
  .records-filters { grid-template-columns: minmax(0, 1fr) minmax(140px, .6fr); }
  .records-filters .search-box { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .records-toolbar { align-items: stretch; flex-direction: column; gap: 13px; }
  .records-toolbar .button { width: 100%; }
  .records-filters { grid-template-columns: 1fr 1fr; }
  .records-summary { align-items: flex-start; flex-direction: column; gap: 5px; }
  .audit-table td:nth-child(5) { min-width: 0; }
  .audit-table td { white-space: normal; }
}

/* Remote skill revision: application pages use the available work area. Large
   management tables and settings sections are separated by rhythm and rules,
   not by a single oversized card. */
.admin-shell { width: 100%; min-height: 100dvh; }
.main { width: 100%; max-width: none; min-height: 100dvh; }
.agent-form-page,
.knowledge-workspace { width: 100%; max-width: none; }
.agent-form-page .field,
.agent-form-page .form-grid { max-width: none; }
.agents-panel,
.records-panel,
.registry-panel {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}
.agents-panel > .card-title,
.records-panel > .card-title,
.registry-panel > .card-title { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.domain-admin-page { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 26px 34px; }
.domain-admin-section { min-width: 0; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.domain-admin-section .content-preview { margin-top: 0; }
.domain-admin-page .registry-panel { grid-column: 1 / -1; margin-top: 0; }
.access-stack { gap: 0; }
.access-stack > .card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.access-stack > .domain-compact { padding: 22px 0; }
.access-stack > .usage-panel { margin: 0; }
.access-stack > .channel-pool { padding: 8px 0 0; }
.access-stack > .channel-pool .channel-pool-head,
.access-stack > .channel-pool .routing-toolbar,
.access-stack > .channel-pool .channel-list-head,
.access-stack > .channel-pool .channel-row { padding-left: 0; padding-right: 0; }
.access-stack > .channel-pool .routing-toolbar { background: transparent; }

.data-table-toolbar { display: grid; grid-template-columns: minmax(260px, 1.4fr) repeat(2, minmax(130px, .55fr)) auto auto; align-items: end; gap: 10px; padding: 0 0 15px; }
.data-table-toolbar .search-box { min-width: 0; }
.data-table-toolbar .data-table-reset { align-self: end; }
.data-table-count { align-self: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.agents-table tr[hidden] { display: none !important; }

.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.field-heading .label { margin: 0; }
.field-error { min-height: 16px; display: block; margin-top: 6px; color: var(--red); font-size: 12px; line-height: 1.45; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255,59,48,.08); }
.sortable-form-list { display: grid; gap: 10px; }
.sortable-form-row { min-width: 0; display: grid; grid-template-columns: 28px 24px minmax(0, 1fr) 38px; align-items: center; gap: 8px; }
.sort-handle { width: 28px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 6px; color: var(--muted); cursor: grab; touch-action: none; }
.sort-handle:active { cursor: grabbing; }
.sortable-index { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; }
.sortable-panel { transition: border-color .15s ease, opacity .15s ease, transform .15s ease; }
.sortable-panel-head { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.sortable-panel-head .sortable-row-title { color: var(--ink); font-size: 12px; }
.sortable-panel-head .switch { margin-left: auto; }
.sortable-panel-head .button { margin-left: auto; }
.sortable-panel-head .switch + .button { margin-left: 0; }
.recommendation-row { min-width: 0; margin: 0; padding: 16px; border: 1px solid rgba(29,29,31,.11); border-radius: 8px; background: rgba(255,255,255,.72); }
.recommendation-row .field { max-width: none; }
.is-dragging { opacity: 1; border-color: var(--blue); transform: none; }
.announcement-icon { overflow: hidden; }
.announcement-icon .public-avatar-image { width: 100%; height: 100%; object-fit: cover; }
.connection-error { color: var(--red); background: rgba(255,59,48,.07); }

.billing-page { width: 100%; border-top: 1px solid var(--line); }
.billing-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 20px 0; border-bottom: 1px solid var(--line); }
.billing-summary > div { display: grid; gap: 6px; padding: 0 22px; border-left: 1px solid var(--line); }
.billing-summary > div:first-child { padding-left: 0; border-left: 0; }
.billing-summary span { color: var(--muted); font-size: 12px; }
.billing-summary strong { color: var(--ink); font-size: 22px; letter-spacing: 0; }
.billing-controls { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 18px 0 0; }
.billing-controls .field { width: min(240px, 100%); margin: 0; }
.billing-controls > span { padding-bottom: 12px; color: var(--muted); font-size: 12px; }
.billing-plan-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; padding: 22px 0; }
.billing-plan { min-width: 0; display: grid; align-content: start; gap: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-align: left; }
.billing-plan:hover { border-color: #98a2b3; }
.billing-plan.selected { border-color: #005fc7; box-shadow: 0 0 0 2px rgba(0,95,199,.12); }
.billing-plan h2 { margin: 6px 0 0; color: var(--ink); font-size: 18px; }
.billing-plan p { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.billing-plan-code { color: var(--blue); font-size: 12px; font-weight: 700; }
.billing-plan dl { display: grid; gap: 9px; margin: 0; }
.billing-plan dl div { display: flex; justify-content: space-between; gap: 12px; }
.billing-plan dt { color: var(--muted); font-size: 12px; }
.billing-plan dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.billing-step-head { display: flex; align-items: flex-start; gap: 11px; margin-top: 22px; }
.billing-step-head > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #344054; font-size: var(--type-label); font-weight: 700; font-variant-numeric: tabular-nums; }
.billing-step-head h2 { margin: 1px 0 0; font-size: var(--type-section); font-weight: 600; }
.billing-step-head p { margin: 3px 0 0; color: var(--body-text); font-size: var(--type-body); }
.billing-checkout { display: grid; grid-template-columns: minmax(220px, 360px) auto; align-items: end; gap: 10px; padding: 16px 0 22px 39px; }
.billing-checkout .field { margin: 0; }
.payment-dialog { width: min(920px, calc(100vw - 32px)); height: min(820px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 16px; }
.payment-frame { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.payment-return-state { min-height: 100dvh; display: grid; place-content: center; gap: 8px; color: var(--ink); background: var(--page); text-align: center; }
.payment-return-state strong { font-size: var(--type-title); font-weight: 700; }
.payment-return-state span { color: var(--body-text); font-size: var(--type-body); }
.custom-api-locked { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.custom-api-locked h2 { margin: 0; color: var(--ink); font-size: var(--type-section); font-weight: 600; line-height: 1.35; }
.custom-api-locked p { max-width: 720px; margin: 6px 0 0; color: var(--body-text); font-size: var(--type-body); line-height: 1.6; }

@media (max-width: 1000px) {
  .data-table-toolbar { grid-template-columns: minmax(0, 1fr) minmax(140px, .55fr); }
  .data-table-toolbar .search-box { grid-column: 1 / -1; }
  .data-table-toolbar .data-table-count { justify-self: end; }
}

@media (max-width: 760px) {
  .domain-admin-page { grid-template-columns: 1fr; gap: 22px; }
  .domain-admin-page .registry-panel { grid-column: auto; }
  .domain-admin-section .card-title { align-items: stretch; flex-direction: column; }
  .domain-admin-section .card-title .button { width: 100%; }
  .data-table-toolbar { grid-template-columns: 1fr 1fr; }
  .data-table-toolbar .search-box { grid-column: 1 / -1; }
  .data-table-toolbar .data-table-reset { width: 100%; }
  .data-table-toolbar .data-table-count { align-self: center; justify-self: end; }
  .access-stack > .channel-pool .channel-pool-head,
  .access-stack > .channel-pool .routing-toolbar,
  .access-stack > .channel-pool .channel-list-head,
  .access-stack > .channel-pool .channel-row { padding-left: 0; padding-right: 0; }
	.field-heading { align-items: stretch; flex-direction: column; }
	.field-heading .button { width: 100%; }
	.sortable-form-row { grid-template-columns: 24px 20px minmax(0, 1fr) 38px; gap: 5px; }
	.recommendation-row { padding: 14px; }
	.billing-summary { grid-template-columns: 1fr; gap: 13px; }
	.billing-summary > div { padding: 0; border-left: 0; }
	.billing-controls { align-items: stretch; flex-direction: column; gap: 8px; }
	.billing-controls .field { width: 100%; }
	.billing-controls > span { padding-bottom: 0; }
	.billing-plan-list { grid-template-columns: 1fr; }
	.billing-checkout { grid-template-columns: 1fr; padding-left: 0; }
	.billing-checkout .button { width: 100%; }
	.custom-api-locked { align-items: stretch; flex-direction: column; }
	.custom-api-locked .button { width: 100%; }
}

.auth-segments { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: -8px 0 24px; padding: 3px; border-radius: 8px; background: var(--surface-soft); }
.auth-segments button { min-height: 34px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.auth-segments button.active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px rgba(23,32,42,.09); }
.login-card [hidden], .agent-form-section [hidden] { display: none !important; }
.login-card { padding: 24px; }
.login-card h1 { margin-bottom: 18px; font-size: 22px; }
.login-card .form-actions { margin-top: 18px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-text-button { padding: 0; border: 0; color: #005fc7; background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.auth-text-button:hover { color: #004c9e; }
.auth-text-button:focus-visible { outline: 3px solid rgba(0,95,199,.24); outline-offset: 3px; }
.auth-back { display: block; margin: 17px auto 0; }
#password-reset-confirm-form .field + .field { margin-top: 14px; }
#register-form > .form-grid + .field { margin-top: 14px; }
.registration-captcha { display: grid; grid-template-columns: minmax(100px, .65fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.registration-captcha > span { min-height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--surface-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.login-card .domain-input { gap: 10px; }
.registration-domain-segments { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 18px 0 14px; padding: 3px; border-radius: 8px; background: var(--surface-soft); }
.registration-domain-segments button { min-height: 38px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: var(--type-body); font-weight: 600; }
.registration-domain-segments button.active { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px rgba(23,32,42,.09); }
.registration-platform-domain { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .8fr); gap: 8px; }

.registration-page { width: 100%; border-top: 1px solid var(--line); }
.registration-page > .agent-form-section { margin: 0; }
.registration-page > .agent-form-section + .agent-form-section { border-top: 1px solid var(--line); }
.email-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.registration-codes-section { padding: 27px 0 0; }
.registration-code-table .table-subline { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.created-codes { min-height: 210px; resize: none; }
.brand-asset-upload { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

.verification-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px max(24px, env(safe-area-inset-bottom)); color: #1d1d1f; background: #f5f5f7; }
.verification-panel { width: min(440px, 100%); display: grid; justify-items: center; gap: 22px; padding: 34px 30px 24px; border: 1px solid rgba(29,29,31,.1); border-radius: 8px; background: rgba(255,255,255,.9); box-shadow: 0 18px 48px rgba(29,29,31,.09); text-align: center; }
.verification-avatar { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: #fff; font-size: 22px; font-weight: 700; box-shadow: 0 7px 18px rgba(29,29,31,.13); }
.verification-avatar .public-avatar-image { width: 100%; height: 100%; object-fit: cover; }
.verification-panel h1 { margin: 0; font-size: 21px; letter-spacing: 0; }
.verification-panel > div > p { margin: 7px 0 0; color: #6e6e73; font-size: 13px; line-height: 1.6; }
.verification-panel footer { color: #8e8e93; font-size: 12px; }
.verification-loading { min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.verification-loading em { margin-left: 7px; color: #6e6e73; font-size: 12px; font-style: normal; }
.verification-error { width: 100%; display: grid; gap: 12px; color: var(--red); font-size: 12px; }
.verification-code-form, .slider-verification { width: 100%; display: grid; gap: 12px; text-align: left; }
.verification-code-form .button { margin-top: 3px; }
.verification-code-form > span, .slider-verification > span { min-height: 17px; color: #6e6e73; font-size: 12px; text-align: center; }
.slider-track { --verification-progress: 0%; position: relative; height: 52px; overflow: hidden; border: 1px solid rgba(29,29,31,.12); border-radius: 8px; background: #f1f2f4; touch-action: none; user-select: none; }
.slider-track > span { position: absolute; inset: 0; display: grid; place-items: center; padding-left: 46px; color: #6e6e73; font-size: 12px; pointer-events: none; }
.slider-progress { position: absolute; inset: 0 auto 0 0; width: var(--verification-progress); background: rgba(0,113,227,.1); transition: width .05s linear; }
.slider-thumb { position: absolute; top: 4px; left: 4px; width: 44px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 7px; color: #fff; background: #0071e3; box-shadow: 0 3px 9px rgba(0,113,227,.25); touch-action: none; transition: left .04s linear, transform .12s ease; }
.slider-thumb:active { transform: none; }
.slider-thumb:focus-visible { outline: 3px solid rgba(0,113,227,.22); outline-offset: 2px; }

@media (max-width: 760px) {
  .login-screen { align-items: start; padding-top: max(24px, env(safe-area-inset-top)); }
  .login-card { padding: 22px 18px; }
  .login-card .form-grid { grid-template-columns: 1fr; gap: 0; }
  .login-card .form-grid .field + .field { margin-top: 14px; }
  .registration-platform-domain { grid-template-columns: 1fr; }
  .registration-codes-section .card-title { align-items: stretch; flex-direction: column; }
  .registration-codes-section .card-title .button { width: 100%; }
  .registration-code-table .table-actions { justify-content: flex-end; }
  .brand-asset-upload { display: grid; grid-template-columns: 1fr 1fr; }
  .verification-panel { padding: 28px 18px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .initial-loader-mark span, .verification-loading > span { animation: none; opacity: .75; transform: none; }
  .slider-progress, .slider-thumb { transition: none; }
}

/* Readability is the primary system constraint. These tokens and role-based
   rules keep Chinese text crisp and consistent across public and console UI. */
:root {
  --type-page-title: 26px;
  --type-section-title: 16px;
  --type-metric: 26px;
  --type-body: 14px;
  --type-label: 13px;
  --type-caption: 12px;
  --ink: #17191c;
  --body-text: #475467;
	--muted: #5b6575;
  --placeholder: #98a2b3;
  --public-ink: #17191c;
	--public-muted: #5b6575;
	--blue: #005fc7;
	--green: #18794e;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: auto;
}

*, *::before, *::after { letter-spacing: 0 !important; }
* { backdrop-filter: none !important; }
body, button, input, textarea, select { font-family: inherit; }
body { color: var(--ink); font-size: var(--type-body); font-weight: 400; line-height: 1.6; }
.admin-shell *, .public-page *, .login-screen *, .settings-overlay * { min-width: 0; }
p, .message, .chat-record-answer, .kb-answer, .complaint-content { color: var(--body-text); font-size: var(--type-body); font-weight: 400; line-height: 1.65; }
.muted, .helper-text, .toggle-description, .page-subtitle, .card-title p, .agent-form-section-head p, .modal-head p { color: var(--muted); opacity: 1; }

.page-title { font-size: var(--type-page-title); font-weight: 700; line-height: 1.3; }
.card-title h2, .section-card h2, .agent-form-section-head h2, .modal-head h2, .records-toolbar h2, .usage-panel-head h2, .channel-pool-head h2 { color: var(--ink); font-size: var(--type-section-title); font-weight: 600; line-height: 1.35; }
.stat-value, .billing-summary strong { color: var(--ink); font-size: var(--type-metric); font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-head, .stat-note, .usage-metric, .agent-health-meta { font-size: var(--type-body); }
.usage-metric strong, .connection-metrics strong { font-weight: 700; font-variant-numeric: tabular-nums; }

.button, .button-small, .nav-button, .public-nav .button, .public-action-button, .preview-chip, .public-topic, .auth-segments button { min-height: 38px; font-size: var(--type-body); font-weight: 600; line-height: 1.45; }
.button:hover, .button:active, .nav-button:active, .preview-chip:active, .public-topic:active, .public-action-button:active, .slider-thumb:active { transform: none; }
.button:disabled { color: #667085; background: #eaecf0; opacity: 1; cursor: not-allowed; }
.nav-button { color: #475467; white-space: normal; }
.nav-button.active { color: #005fc7; }
.sidebar-section, .eyebrow { color: #667085; font-size: var(--type-caption); font-weight: 600; }
.sidebar-user, .agent-mini-name { color: var(--ink); font-size: var(--type-label); font-weight: 600; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.agent-mini-status, .quota-row { color: var(--muted); font-size: var(--type-caption); }

.input, .textarea, .select { min-height: 42px; color: var(--ink); font-size: var(--type-body); font-weight: 400; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); opacity: 1; }
.label, .toggle-label { color: #475467; font-size: var(--type-label); font-weight: 600; line-height: 1.5; }
.helper-text, .field-error, .toggle-description, .page-subtitle, .card-title p, .agent-form-section-head p, .modal-head p, .records-toolbar p, .records-summary, .knowledge-summary { font-size: var(--type-caption); font-weight: 400; line-height: 1.6; }
.button:focus-visible, .input:focus-visible, .textarea:focus-visible, .select:focus-visible, .nav-button:focus-visible, .public-topic:focus-visible { outline: 3px solid rgba(0, 95, 199, .28); outline-offset: 2px; }

.agents-table { font-size: var(--type-body); line-height: 1.5; }
.agents-table th { height: 44px; padding: 10px 12px; color: #475467; font-size: var(--type-label); font-weight: 600; line-height: 1.45; vertical-align: middle; }
.agents-table td { min-height: 44px; padding: 14px 12px; color: var(--ink); font-size: var(--type-body); line-height: 1.55; }
.agents-table strong, .agent-cell strong { font-size: var(--type-body); font-weight: 600; }
.table-subline, .agent-cell span, .endpoint-cell { color: var(--muted); font-size: var(--type-caption); line-height: 1.55; }
.status-dot, .tag, .chat-source, .usage-report-status { font-size: var(--type-label); font-weight: 600; line-height: 1.45; }
.status-dot, .chat-source, .usage-report-status.reported { color: #18794e; }
.tag { color: #475467; }
.tag-blue { color: #004fa8; }
.workspace-link { color: #0059b8; }
.table-sort { font-size: var(--type-body); }
.audit-id, .audit-ip, .record-device, .agents-table [data-sort-value] { font-variant-numeric: tabular-nums; }
.complaint-content { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.chat-question, .chat-record-question, .kb-question, .test-result-head, .preview-name, .public-chat-name { color: var(--ink); font-size: var(--type-body); font-weight: 600; line-height: 1.55; }
.chat-answer, .chat-record-answer, .kb-answer, .test-result p { color: var(--body-text); font-size: var(--type-body); }
.chat-answer { white-space: normal; overflow: visible; text-overflow: clip; }
.tag, .chat-source { white-space: normal; }
.empty { color: var(--muted); font-size: var(--type-body); line-height: 1.65; }

.public-brand .brand-name, .public-chat-name { max-width: none; overflow: visible; font-size: var(--type-body); font-weight: 600; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.public-context, .public-trust, .public-chat-status, .public-chat-count, .public-aside-label, .public-topic-index, .public-status-line, .public-aside-note p, .public-disclosure, .public-history-eyebrow, .public-history-item-time, .announcement-eyebrow { color: var(--public-muted) !important; font-size: var(--type-caption) !important; line-height: 1.55; }
.public-empty-prompt p, .public-recommendation p, .public-clean .public-marquee p { color: var(--body-text); font-size: var(--type-body); }
.message { color: #344054; font-size: var(--type-body); line-height: 1.65; }
.message.user { color: #fff; }
.message .message-meta, .context-notice { font-size: var(--type-caption); }
.public-history-item-title { overflow: visible; color: var(--public-ink); font-size: var(--type-body); font-weight: 600; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.public-disclosure { max-width: 680px; }

.is-dragging { opacity: 1; transform: none; }
.login-card h1, .verification-panel h1 { font-weight: 700; line-height: 1.3; }
.login-card p, .verification-panel > div > p { color: var(--body-text); font-size: var(--type-body); }
.toast { font-size: var(--type-body); font-weight: 500; line-height: 1.55; }

@media (max-width: 760px) {
  body, p, .message, .input, .textarea, .select, .agents-table td, .chat-answer, .chat-record-answer, .kb-answer { font-size: var(--type-body); }
  .page-title { font-size: 24px; }
  .public-brand .brand-name { max-width: 150px; }
  .preview-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-chip { min-height: 44px; padding: 8px; }
  .agents-table tr { min-height: 44px; }
  .agents-table td::before { color: #475467; font-size: var(--type-label); font-weight: 600; }
  .complaint-content { text-align: left; }
}

@media (prefers-contrast: more) {
  :root { --muted: #475467; --public-muted: #475467; }
  .input::placeholder, .textarea::placeholder { color: #667085; }
}

/* Resource library and knowledge retrieval controls. */
@media (min-width: 761px) {
  .sidebar { overflow-y: auto; }
}

.resource-workspace,
.resource-admin-layout { width: 100%; display: grid; gap: 28px; }
.resource-upload-strip,
.resource-list-head,
.resource-recall-panel form { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.resource-upload-strip { padding: 4px 0 24px; border-bottom: 1px solid var(--line); }
.resource-upload-strip h2,
.resource-list-head h2,
.resource-recall-panel h2 { margin: 0; color: var(--ink); font-size: var(--type-section-title); font-weight: 600; line-height: 1.35; }
.resource-upload-strip p,
.resource-list-head p,
.resource-recall-panel p { max-width: 760px; margin: 6px 0 0; color: var(--muted); font-size: var(--type-body); line-height: 1.65; }
.resource-upload-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.resource-list-section { min-width: 0; }
.resource-list-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.resource-sort-list { display: grid; }
.resource-manage-row { min-width: 0; display: grid; grid-template-columns: 34px 68px minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.resource-manage-row:last-child { border-bottom: 0; }
.resource-sort-handle { margin-top: 26px; border: 0; background: transparent; }
.resource-file-mark { min-height: 62px; display: grid; place-items: center; align-content: center; gap: 6px; margin-top: 25px; border: 1px solid var(--line); border-radius: 8px; color: #005fc7; background: var(--surface); }
.resource-file-mark span { color: var(--muted); font-size: var(--type-caption); font-weight: 600; }
.resource-form-fields { min-width: 0; display: grid; gap: 14px; }
.resource-form-fields .field + .field { margin-top: 0; }
.resource-row-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--muted); font-size: var(--type-caption); line-height: 1.55; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.resource-row-actions { display: grid; grid-template-columns: auto auto 40px; align-items: center; gap: 7px; margin-top: 25px; }
.resource-recall-panel { padding: 20px 0 24px; border-bottom: 1px solid var(--line); }
.resource-recall-control { min-width: min(360px, 100%); display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: end; gap: 10px; }
.resource-recall-control .field { margin: 0; }
.resource-description-line { max-width: 460px; display: block; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
.resource-admin-table td { vertical-align: top; }
.resource-admin-table td:nth-child(1) { min-width: 260px; }
.resource-admin-table td:nth-child(3) { min-width: 230px; }
.resource-admin-table .workspace-link { display: inline-flex; align-items: center; gap: 5px; white-space: normal; overflow-wrap: anywhere; }

.public-resource-button,
.public-complaint-button { min-height: 38px; gap: 6px; color: var(--public-muted); }
.public-resource-button:hover,
.public-complaint-button:hover { color: var(--public-blue); background: rgba(0, 95, 199, .07); }
.resource-dialog-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.resource-dialog-identity h2 { margin: 0; }
.resource-dialog-avatar { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 8px; color: #fff; font-size: 18px; font-weight: 700; }
.resource-dialog-avatar .public-avatar-image { width: 100%; height: 100%; object-fit: cover; }
.public-resource-list { display: grid; }
.public-resource-item { min-width: 0; display: grid; grid-template-columns: 30px 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.public-resource-item:first-child { border-top: 0; padding-top: 2px; }
.public-resource-item:last-child { padding-bottom: 2px; }
.public-resource-item:hover strong { color: #005fc7; }
.public-resource-index { color: var(--muted); font-size: var(--type-caption); font-variant-numeric: tabular-nums; }
.public-resource-icon { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #005fc7; background: var(--surface-soft); }
.public-resource-copy { min-width: 0; display: grid; gap: 3px; }
.public-resource-copy strong { color: var(--ink); font-size: var(--type-body); font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.public-resource-copy > span { color: var(--body-text); font-size: var(--type-body); line-height: 1.6; overflow-wrap: anywhere; }
.public-resource-copy small { color: var(--muted); font-size: var(--type-caption); line-height: 1.5; font-variant-numeric: tabular-nums; }
.public-resource-open { display: inline-flex; align-items: center; gap: 5px; color: #005fc7; font-size: var(--type-label); font-weight: 600; white-space: nowrap; }

@media (max-width: 900px) {
  .resource-manage-row { grid-template-columns: 30px 58px minmax(0, 1fr); }
  .resource-row-actions { grid-column: 3; display: flex; flex-wrap: wrap; margin-top: 0; }
}

@media (max-width: 760px) {
  .resource-upload-strip,
  .resource-list-head,
  .resource-recall-panel form { align-items: stretch; flex-direction: column; gap: 14px; }
  .resource-upload-actions,
  .resource-upload-actions .button,
  .resource-list-head .button { width: 100%; }
  .resource-manage-row { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 18px 0; }
  .resource-sort-handle { grid-row: 1 / span 2; margin-top: 25px; }
  .resource-file-mark { display: none; }
  .resource-form-fields { grid-column: 2; }
  .resource-form-fields .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .resource-row-actions { grid-column: 2; width: 100%; }
  .resource-row-actions .button { flex: 1 1 auto; }
  .resource-recall-control { min-width: 0; grid-template-columns: 1fr; }
  .public-resource-button,
  .public-complaint-button { min-width: 38px; padding: 0 8px; }
  .public-resource-button span,
  .public-complaint-button span { display: none; }
  .public-resource-item { grid-template-columns: 24px 38px minmax(0, 1fr); gap: 9px; }
  .public-resource-open { grid-column: 3; justify-self: start; margin-top: 3px; }
  .public-resource-copy > span { font-size: var(--type-label); }
  .nav-button,
  .nav-button span { min-width: max-content; white-space: nowrap; word-break: keep-all; writing-mode: horizontal-tb; }
}

/* Agent workspace density: reduce travel and unused space without reducing
   text size, control height, or table readability. */
@media (min-width: 761px) {
  .agent-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .agent-shell .sidebar { padding: 16px 10px 12px; }
  .agent-shell .sidebar-section { margin: 18px 7px 6px; }
  .agent-shell .nav { gap: 1px; }
  .agent-shell .nav-button { min-height: 38px; padding: 7px 9px; gap: 9px; }
  .agent-shell .agent-mini { padding: 10px; }
  .agent-shell .quota { margin-top: 9px; }
  .agent-shell .sidebar-footer { margin-top: 9px; padding-top: 9px; }
  .agent-shell .main { padding: 18px 28px 30px; }
  .agent-shell .topbar { margin: -18px -28px 14px; padding: 16px 28px 12px; }
  .agent-shell .eyebrow { margin-bottom: 3px; }
  .agent-shell .page-subtitle { margin-top: 4px; }
  .agent-shell .stats-grid { gap: 9px; }
  .agent-shell .stat-card { min-height: 104px; padding: 13px 14px; }
  .agent-shell .stat-value { margin-top: 5px; }
  .agent-shell .dashboard-grid,
  .agent-shell .settings-grid,
  .agent-shell .kb-layout { gap: 10px; margin-top: 10px; }
  .agent-shell .card-pad,
  .agent-shell .section-card { padding: 15px; }
  .agent-shell .card-title { margin-bottom: 11px; }
  .agent-shell .agent-form-section { padding: 16px 0 18px; }
  .agent-shell .agent-form-section-head { min-height: 0; gap: 16px; margin-bottom: 13px; }
  .agent-shell .agent-form-section-head p { margin-top: 3px; }
  .agent-shell .agent-form-page > .agent-form-save { padding: 12px 0 2px; }
  .agent-shell .field { gap: 5px; }
  .agent-shell .field + .field { margin-top: 11px; }
  .agent-shell .form-grid { gap: 12px; }
  .agent-shell .form-grid .field + .field { margin-top: 0; }
  .agent-shell .textarea { min-height: 88px; }
  .agent-shell .sortable-form-list { gap: 8px; }
  .agent-shell .recommendation-row { padding: 13px; }
  .agent-shell .sortable-panel-head { margin-bottom: 10px; }
  .agent-shell .resource-workspace { gap: 19px; }
  .agent-shell .resource-upload-strip { padding-bottom: 17px; }
  .agent-shell .resource-list-head { padding-bottom: 13px; }
  .agent-shell .resource-manage-row { padding: 15px 0; }
  .agent-shell .billing-summary { padding: 14px 0; }
  .agent-shell .billing-controls { padding-top: 13px; }
  .agent-shell .billing-plan-list { gap: 9px; padding: 16px 0; }
  .agent-shell .billing-plan { gap: 13px; padding: 15px; }
}

.epay-channel-list { display: grid; gap: 8px; }
.epay-channel-row { min-width: 0; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) minmax(150px, auto) 40px; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.epay-channel-row .field { max-width: none; }
.epay-channel-switch { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 6px; color: var(--ink); }
.epay-channel-switch > span:first-child { display: grid; gap: 1px; }
.epay-channel-switch strong { font-size: var(--type-label); font-weight: 600; }
.epay-channel-switch small { color: var(--muted); font-size: var(--type-caption); line-height: 1.4; }

.verification-code-form,
.verification-math-form,
.verification-question-form,
.slider-verification { width: 100%; display: grid; gap: 12px; text-align: left; }
.verification-math-form { grid-template-columns: minmax(0, 1fr) minmax(104px, .55fr); align-items: end; }
.verification-math-question { grid-column: 1 / -1; min-height: 58px; display: grid; place-items: center; border: 1px solid rgba(29,29,31,.12); border-radius: 8px; color: #17191c; background: #f1f2f4; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.verification-math-form > #verification-status { grid-column: 1 / -1; min-height: 18px; color: #5b6575; font-size: var(--type-caption); text-align: center; }
.verification-question-title { min-height: 58px; display: grid; place-items: center; padding: 10px 14px; border: 1px solid rgba(29,29,31,.12); border-radius: 8px; color: #17191c; background: #f1f2f4; font-size: var(--type-body); font-weight: 600; line-height: 1.55; text-align: center; overflow-wrap: anywhere; }
.verification-question-form > #verification-status { min-height: 18px; color: #5b6575; font-size: var(--type-caption); text-align: center; }
.slider-track { width: 100%; min-height: 54px; isolation: isolate; cursor: ew-resize; }
.slider-progress { z-index: 1; }
.slider-track > span { z-index: 2; padding: 0 14px 0 88px; color: #475467; font-size: var(--type-label); font-weight: 500; }
.slider-thumb { z-index: 3; width: 76px; min-width: 76px; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; appearance: none; visibility: visible; opacity: 1; color: #fff; background: #005fc7; font-size: var(--type-label); font-weight: 600; }
.slider-thumb span { pointer-events: none; }
.verification-panel footer { color: #667085; font-size: var(--type-caption); line-height: 1.55; }

/* Dense administration work surfaces. Repeated configuration uses tables and
   keeps full editing in focused dialogs. */
.config-table-wrap { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.dense-config-table { min-width: 760px; table-layout: auto; }
.dense-config-table th { height: 40px; padding: 8px 10px; }
.dense-config-table td { min-height: 44px; padding: 9px 10px; vertical-align: middle; }
.dense-config-table th:first-child,
.dense-config-table td:first-child { width: 78px; }
.dense-config-table th:last-child,
.dense-config-table td:last-child { width: 92px; }
.dense-config-table .sort-handle { display: inline-flex; vertical-align: middle; }
.dense-config-table .sortable-index { display: inline-block; min-width: 22px; margin-left: 6px; color: var(--muted); font-variant-numeric: tabular-nums; }
.config-value-preview { max-width: 360px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-block-title { display: block; margin-top: 5px; }
.knowledge-table { min-width: 1040px; }
.knowledge-table td:first-child { width: auto; min-width: 200px; }
.knowledge-table td:nth-child(3) { min-width: 250px; }
.resource-agent-table { min-width: 850px; }
.resource-agent-table td:nth-child(2) { min-width: 250px; }
.resource-agent-table td:nth-child(3) { min-width: 220px; }
.file-input { height: auto; padding: 8px 10px; }
.chat-source-actions { display: flex; justify-content: flex-end; gap: 7px; margin-bottom: 10px; }

.support-dialog { width: min(820px, 100%); }
.support-message-list { min-height: 260px; max-height: 52dvh; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 3px; }
.support-message { width: min(82%, 620px); align-self: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.support-message.own { align-self: flex-end; border-color: rgba(0, 95, 199, .24); background: rgba(0, 95, 199, .07); }
.support-message header { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: var(--type-caption); line-height: 1.5; }
.support-message header strong { color: var(--ink); font-size: var(--type-label); font-weight: 600; }
.support-message p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-image-link { display: block; margin-top: 9px; }
.support-image-link img { width: auto; max-width: min(100%, 420px); max-height: 320px; display: block; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; background: var(--surface); }
.support-file { min-width: 0; display: flex; align-items: center; gap: 9px; margin-top: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface); text-decoration: none; }
.support-file span { min-width: 0; display: grid; }
.support-file strong { overflow-wrap: anywhere; }
.support-file small { color: var(--muted); font-size: var(--type-caption); }
.support-reply-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.support-reply-actions { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.support-reply-actions .helper-text { flex: 1 1 auto; overflow-wrap: anywhere; }
.support-preview { max-width: 360px; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--body-text); }

@media (min-width: 761px) {
  .admin-shell { grid-template-columns: 202px minmax(0, 1fr); }
  .admin-shell .sidebar { padding: 13px 9px 10px; }
  .admin-shell .main { padding: 14px 20px 28px; }
  .admin-shell .topbar { margin: -14px -20px 10px; padding: 13px 20px 10px; }
  .admin-shell .sidebar-section { margin: 13px 7px 5px; }
  .admin-shell .nav { gap: 1px; }
  .admin-shell .nav-button { min-height: 36px; padding: 6px 8px; gap: 8px; }
  .agent-shell { grid-template-columns: 196px minmax(0, 1fr); }
  .agent-shell .main { padding: 12px 18px 24px; }
  .agent-shell .topbar { margin: -12px -18px 9px; padding: 12px 18px 9px; }
  .agent-shell .agent-form-section { padding: 12px 0 14px; }
  .agent-shell .agent-form-section-head { margin-bottom: 10px; }
  .agent-shell .field + .field { margin-top: 9px; }
  .agent-shell .form-grid { gap: 10px; }
  .agent-shell .textarea { min-height: 76px; }
  .resource-workspace, .resource-admin-layout { gap: 18px; }
  .resource-upload-strip { padding: 2px 0 14px; }
  .resource-list-head { padding-bottom: 10px; }
}

@media (max-width: 760px) {
  .config-table-wrap { border-radius: 6px; }
  .dense-config-table,
  .knowledge-table,
  .resource-agent-table { min-width: 0; }
  .topbar { margin: 0 -14px 12px; padding: 11px 14px 10px; }
  .agent-form-section-head > .button,
  .field-heading > .button { flex: 0 0 auto; white-space: nowrap; }
  .dense-config-table tr { padding: 9px 10px; }
  .dense-config-table td,
  .dense-config-table td:first-child,
  .dense-config-table td:last-child { width: auto; min-height: 0; padding: 5px 0; }
  .dense-config-table td { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 2px 10px; text-align: left; }
  .dense-config-table td::before { grid-column: 1; }
  .dense-config-table td > * { grid-column: 2; }
  .dense-config-table td:first-child { display: flex; justify-content: flex-start; }
  .dense-config-table td:first-child::before { display: none; }
  .dense-config-table .row-actions { justify-content: flex-start; flex-wrap: nowrap; }
  .config-value-preview { max-width: calc(100vw - 130px); }
  .support-message { width: 92%; }
  .support-reply-actions { align-items: stretch; flex-wrap: wrap; }
  .support-reply-actions .button-primary { width: 100%; }
  .chat-source-actions { justify-content: stretch; }
  .chat-source-actions .button { flex: 1; }
}

@media (max-width: 760px) {
  .epay-channel-row { grid-template-columns: minmax(0, 1fr) 40px; }
  .epay-channel-row .field,
  .epay-channel-switch { grid-column: 1; }
  .epay-channel-row > .button { grid-column: 2; grid-row: 1; }
  .verification-math-form { grid-template-columns: 1fr; }
  .verification-math-question,
.verification-math-form > #verification-status { grid-column: 1; }
}

/* Persistent filters, unread feedback, and read-only payment reconciliation. */
.icon-xs { width: 14px; height: 14px; flex: 0 0 auto; }
.nav-badge { min-width: 22px; height: 22px; display: inline-grid; place-items: center; margin-left: auto; padding: 0 6px; border-radius: 11px; color: #fff; background: #d92d20; font-size: 12px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.nav-badge[hidden] { display: none; }
.data-table-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.data-table-toolbar .search-box { flex: 1 1 280px; }
.data-table-toolbar .filter-field { flex: 0 1 160px; }
.data-table-toolbar .data-table-save,
.data-table-toolbar .data-table-reset { flex: 0 0 auto; }
.data-table-toolbar .data-table-save.is-saved { color: #067647; border-color: #a6f4c5; background: #ecfdf3; }
.data-table-count { margin-left: auto; }
.support-unread-summary { min-height: 32px; display: inline-flex; align-items: center; color: #475467; font-size: var(--type-label); font-weight: 600; font-variant-numeric: tabular-nums; }
.support-row-unread td { background: #f5f9ff; }
.support-row-unread td:first-child { box-shadow: inset 3px 0 #005fc7; }
.unread-pill { display: inline-flex; align-items: center; min-height: 24px; margin-left: 7px; padding: 2px 7px; border-radius: 8px; color: #004eaa; background: #eaf3ff; font-size: var(--type-caption); font-weight: 600; font-variant-numeric: tabular-nums; }
.support-scan-status { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: #067647; font-size: var(--type-caption); font-weight: 600; line-height: 1.5; }
.reconciliation-workspace { width: 100%; min-width: 0; display: grid; gap: 16px; }
.reconciliation-summary { min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.reconciliation-summary > div { min-width: 0; display: grid; gap: 5px; padding: 14px 16px; border-left: 1px solid var(--line); }
.reconciliation-summary > div:first-child { border-left: 0; }
.reconciliation-summary span { color: var(--muted); font-size: var(--type-label); font-weight: 500; }
.reconciliation-summary strong { color: var(--ink); font-size: 21px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.reconciliation-summary .has-exception strong { color: #b42318; }
.reconciliation-head { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.reconciliation-head h2 { margin: 0; color: var(--ink); font-size: var(--type-section-title); font-weight: 600; line-height: 1.35; }
.reconciliation-head p { max-width: 760px; margin: 5px 0 0; color: var(--muted); font-size: var(--type-body); line-height: 1.6; }
.reconciliation-table { min-width: 1280px; }
.reconciliation-table th,
.reconciliation-table td { white-space: nowrap; }
.reconciliation-table td:last-child { min-width: 210px; white-space: normal; }
.mono-value { font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: var(--type-label); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

@media (min-width: 761px) {
  .table-scroll { max-height: calc(100dvh - 255px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .table-scroll thead th { position: sticky; top: 0; z-index: 3; background: #f6f7f9; box-shadow: inset 0 -1px var(--line); }
}

@media (max-width: 980px) {
  .reconciliation-summary { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .reconciliation-summary > div:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .reconciliation-summary > div:nth-child(5) { border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .data-table-toolbar { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
  .data-table-toolbar .search-box { grid-column: 1 / -1; }
  .data-table-toolbar .filter-field { min-width: 0; }
  .data-table-toolbar .data-table-save,
  .data-table-toolbar .data-table-reset { width: 100%; }
  .data-table-count { margin-left: 0; justify-self: end; }
  .reconciliation-summary { grid-template-columns: 1fr 1fr; }
  .reconciliation-summary > div { border-top: 1px solid var(--line); }
  .reconciliation-summary > div:nth-child(-n+2) { border-top: 0; }
  .reconciliation-summary > div:nth-child(odd) { border-left: 0; }
  .reconciliation-summary strong { font-size: 20px; }
  .reconciliation-head { align-items: stretch; flex-direction: column; }
  .reconciliation-head .button { width: 100%; }
  .reconciliation-table { min-width: 0; }
  .reconciliation-table th,
  .reconciliation-table td { white-space: normal; }
  .support-row-unread td { background: transparent; }
  .support-row-unread { box-shadow: inset 3px 0 #005fc7; }
  .support-page-head { align-items: stretch; flex-direction: column; gap: 13px; }
  .support-page-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .support-page-actions .support-unread-summary { grid-column: 1 / -1; min-height: 24px; }
  .support-page-actions .button { width: 100%; }
  .support-page-actions.admin-only #support-refresh { grid-column: 1 / -1; }
}
