/* Copyright (C) 2026 Jason Yang <flyangqn@gmail.com> */
/* SPDX-License-Identifier: AGPL-3.0-only */
/* Commercial licensing: contact flyangqn@gmail.com. */

:root {
  --bg: #08100f;
  --surface: rgba(15, 27, 25, 0.88);
  --surface-strong: #132522;
  --surface-soft: #172d29;
  --line: rgba(163, 200, 188, 0.16);
  --line-strong: rgba(163, 200, 188, 0.29);
  --text: #ecf6f1;
  --muted: #91aaa1;
  --green: #77e5b5;
  --green-strong: #39c98e;
  --amber: #f2c879;
  --red: #ff8c83;
  --blue: #8bbcff;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}


* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 75% 0%, #14332c 0, var(--bg) 34rem); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
code, pre, textarea.code-editor { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.hidden { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(110px); opacity: .14; pointer-events: none; }
.ambient-one { width: 26rem; height: 26rem; background: var(--green); top: -12rem; right: 5vw; }
.ambient-two { width: 20rem; height: 20rem; background: #4c82da; bottom: 2rem; left: -12rem; }

.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1480px) / 2)); display: flex; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); background: rgba(8, 16, 15, .78); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(119, 229, 181, .5); border-radius: 13px; color: var(--green); font: 700 13px/1 monospace; background: linear-gradient(145deg, rgba(119,229,181,.15), transparent); box-shadow: inset 0 0 24px rgba(119,229,181,.06); }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .01em; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 2px; letter-spacing: .12em; text-transform: uppercase; }
.main-nav { display: flex; align-items: center; gap: 2px; padding: 5px; border: 1px solid rgba(163,200,188,.13); border-radius: 14px; background: rgba(255,255,255,.025); box-shadow: inset 0 1px rgba(255,255,255,.035); }
.main-nav a { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 10px; border: 1px solid transparent; border-radius: 10px; color: #8ca69d; text-decoration: none; white-space: nowrap; font-size: 12px; font-weight: 550; transition: color .16s ease, border-color .16s ease, background .16s ease; }
.main-nav a:hover { color: var(--text); background: rgba(119,229,181,.07); }
.main-nav a.active { border-color: rgba(119,229,181,.22); color: #dff8ea; background: linear-gradient(145deg, rgba(119,229,181,.15), rgba(119,229,181,.045)); box-shadow: inset 0 1px rgba(255,255,255,.05); }
.main-nav a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.main-nav-icon { flex: 0 0 16px; width: 16px; height: 16px; display: inline-grid; place-items: center; color: #7aab94; }
.main-nav-icon svg { width: 16px; height: 16px; }
.main-nav a.active .main-nav-icon { color: var(--green); }
.mobile-nav-toggle, .mobile-nav-header, .mobile-nav-account, .mobile-nav-scrim { display: none; }
.service-state { display: flex; align-items: center; flex-shrink: 0; gap: 9px; color: var(--muted); font-size: 13px; line-height: 1.4; white-space: nowrap; }
#service-label { white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(242,200,121,.1); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(119,229,181,.1), 0 0 16px rgba(119,229,181,.45); }
.status-dot.offline { background: var(--red); }
.local-badge { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); font: 700 10px/1 monospace; letter-spacing: .12em; }

.page { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 54px 0 80px; position: relative; z-index: 1; }
.hero { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 34px; }
.eyebrow, .section-kicker { margin: 0 0 10px; color: var(--green); font: 700 11px/1.4 monospace; letter-spacing: .15em; }
h1 { max-width: 900px; margin: 0; font-size: clamp(38px, 5vw, 72px); line-height: 1.04; letter-spacing: -.045em; font-weight: 650; }
h1 span { color: #9eb5ad; }
.hero-copy { max-width: 690px; color: var(--muted); font-size: 16px; line-height: 1.7; margin: 22px 0 0; }
.compact-hero h1 { font-size: clamp(36px, 4.4vw, 64px); }
.phase-card { min-width: 260px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(119,229,181,.09), rgba(15,27,25,.88)); box-shadow: var(--shadow); }
.phase-card span, .phase-card small, .phase-card strong { display: block; }
.phase-card span { color: var(--muted); font-size: 12px; }
.phase-card strong { margin: 12px 0 8px; font-size: 19px; }
.phase-card small { color: var(--green); }
.action-card { color: var(--text); text-decoration: none; transition: transform .16s ease, border-color .16s ease; }
.action-card:hover { transform: translateY(-2px); border-color: rgba(119,229,181,.42); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metrics article { min-height: 126px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgba(13, 24, 22, .74); }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin: 12px 0 7px; font-size: 30px; font-weight: 600; letter-spacing: -.03em; }

.workspace-grid { display: grid; grid-template-columns: minmax(360px, .85fr) minmax(520px, 1.35fr); gap: 18px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.trace-page .trace-overview-panel { scroll-margin-top: 96px; }
.inventory-panel, .detail-panel, .form-panel, .audit-panel { padding: 24px; }
.detail-panel { min-height: 650px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-header h2, .subsection h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
.panel-header h2 { font-size: 22px; }
.panel-header > span { color: var(--muted); font-size: 12px; }
.panel-copy { color: var(--muted); line-height: 1.65; font-size: 14px; }

.button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; color: var(--text); background: var(--surface-soft); transition: transform .14s ease, border-color .14s ease, background .14s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: var(--green); color: #082019; font-weight: 700; }
.button.secondary { border-color: var(--line-strong); }
.button.ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.button.danger { border-color: rgba(255,140,131,.45); color: #ffd7d3; background: rgba(255,140,131,.1); }

.filter-row { display: flex; gap: 8px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.filter { border: 0; padding: 8px 11px; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; }
.filter.active { color: var(--text); background: var(--surface-soft); }
.capability-list { display: grid; gap: 9px; margin-top: 15px; max-height: 570px; overflow-y: auto; padding-right: 3px; }
.capability-card { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 14px; text-align: left; color: var(--text); border: 1px solid transparent; border-radius: 13px; background: rgba(255,255,255,.02); }
.capability-card:hover, .capability-card.selected { border-color: var(--line-strong); background: rgba(119,229,181,.055); }
.kind-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-soft); color: var(--green); font: 700 11px/1 monospace; }
.capability-card strong, .capability-card small { display: block; overflow: hidden; text-overflow: ellipsis; }
.capability-card strong { font-size: 14px; }
.capability-card small { color: var(--muted); margin-top: 5px; font-size: 11px; white-space: nowrap; }
.card-state { width: 8px; height: 8px; border-radius: 50%; background: #52665f; }
.card-state.enabled { background: var(--green-strong); box-shadow: 0 0 12px rgba(57,201,142,.5); }
.list-message { color: var(--muted); text-align: center; padding: 54px 15px; }

.empty-state { min-height: 590px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--text); margin: 18px 0 7px; }
.empty-state p { max-width: 340px; line-height: 1.6; margin: 0; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: auto; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--green); font-size: 22px; }
.detail-heading { margin-bottom: 10px; }
.pill { padding: 6px 10px; border-radius: 999px; background: rgba(145,170,161,.12); color: var(--muted); font-size: 11px; }
.pill.enabled { color: var(--green); background: rgba(119,229,181,.1); }
.detail-description { color: var(--muted); line-height: 1.6; }
.metadata { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 22px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.metadata div { min-width: 0; padding: 13px; background: var(--surface-strong); }
.metadata dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.metadata dd { overflow: hidden; margin: 5px 0 0; font: 12px/1.5 monospace; text-overflow: ellipsis; white-space: nowrap; }
.metadata .wide { grid-column: 1 / -1; }
.action-row { display: flex; gap: 9px; flex-wrap: wrap; }
.readonly-notice { display: flex; align-items: center; gap: 9px; margin: 18px 0; padding: 12px 13px; border: 1px solid rgba(139,188,255,.22); border-radius: 10px; color: var(--muted); background: rgba(139,188,255,.055); font-size: 12px; line-height: 1.5; }
.readonly-notice span { padding: 3px 7px; border-radius: 6px; color: var(--blue); background: rgba(139,188,255,.1); font: 700 10px/1 monospace; text-transform: uppercase; }
.subsection { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.subsection-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.subsection-title h3 { font-size: 15px; }
.subsection-title span { color: var(--muted); font-size: 11px; }
.permission-list { display: flex; flex-wrap: wrap; gap: 8px; }
.permission { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font: 11px/1 monospace; }
.permission::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.permission.allow::before { background: var(--green); }
.permission.deny::before { background: var(--red); }
.permission-help { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.runtime-section .subsection-title { align-items: flex-start; }
.runtime-section .subsection-title h3, .runtime-section .subsection-title p { margin: 0; }
.runtime-section .subsection-title p { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#python-runtime-status[data-status="ready"] { color: var(--green); }
#python-runtime-status[data-status="missing"], #python-runtime-status[data-status="needs_binding"] { color: var(--amber); }
#python-runtime-status[data-status="conda_unavailable"] { color: var(--red); }
.runtime-path { display: grid; gap: 5px; margin-bottom: 13px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.runtime-path span { color: var(--muted); font-size: 10px; }
.runtime-path code { overflow-wrap: anywhere; color: #c7ded5; font-size: 11px; }
.runtime-form-grid { display: grid; grid-template-columns: minmax(130px, .35fr) minmax(260px, 1fr); gap: 10px; margin-bottom: 12px; }
.runtime-form-grid label { display: grid; align-content: start; gap: 6px; color: var(--muted); font-size: 11px; }
.runtime-form-grid input, .runtime-form-grid textarea { width: 100%; }
.runtime-form-grid small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.runtime-section > .permission-help { margin-top: 10px; margin-bottom: 0; }
.secret-list { display: grid; gap: 10px; }
.secret-row { display: grid; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.secret-row-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.secret-row-heading strong, .secret-row-heading small { display: block; }
.secret-row-heading strong { font-size: 12px; font-weight: 600; }
.secret-row-heading small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.secret-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.secret-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.secret-status.configured { color: var(--green); }
.secret-status.configured::before { background: var(--green); box-shadow: 0 0 0 4px rgba(119,229,181,.07); }
.secret-controls { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto; gap: 8px; }
.secret-controls input { min-width: 0; height: 40px; padding: 9px 11px; }
.danger-button { color: #ff9a92; }
.capability-danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px; border: 1px solid rgba(255,140,131,.18); border-radius: 12px; background: rgba(255,140,131,.035); }
.capability-danger-zone h3, .capability-danger-zone p { margin: 0; }
.capability-danger-zone h3 { color: #ffd0cb; font-size: 13px; }
.capability-danger-zone p { max-width: 540px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.capability-danger-zone .danger-button { flex: 0 0 auto; border-color: rgba(255,140,131,.3); }
.validation-checks { display: grid; gap: 8px; }
.validation-check { display: grid; grid-template-columns: minmax(120px, .35fr) 1fr; gap: 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); }
.validation-check strong { color: var(--green); font: 11px/1.5 monospace; }
.validation-check.failed strong { color: var(--red); }
.validation-check.blocked strong { color: var(--amber); }
.validation-check span, .muted-copy { color: var(--muted); font-size: 12px; line-height: 1.5; }
.muted-copy { margin: 0; }
.test-box { background: rgba(5,13,12,.35); margin-left: -8px; margin-right: -8px; padding: 20px 8px 0; border-radius: 12px; }
.test-box form { display: grid; gap: 12px; }
.result-view, .manifest-details pre { overflow: auto; max-height: 320px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; color: #c7ded5; background: #07100e; font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.confirmation { display: flex !important; flex-direction: row !important; align-items: flex-start; gap: 9px !important; color: var(--muted); font-size: 12px; line-height: 1.5; }
.confirmation input { width: auto; margin-top: 2px; }
.manifest-details { margin-top: 20px; }
.manifest-details summary { cursor: pointer; color: var(--muted); font-size: 12px; }

/* Services: keep the user focused on choosing a capability and taking the next action. */
.services-page-shell { width: min(1360px, calc(100% - 48px)); padding-top: 34px; }
.services-overview { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.services-overview-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.services-overview-actions > .button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.services-heading .eyebrow { margin-bottom: 7px; }
.services-heading h1 { font-size: clamp(36px, 4vw, 52px); line-height: 1; }
.services-heading > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.add-capability-button { flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 18px; text-decoration: none; }
.add-capability-button span { font-size: 19px; font-weight: 400; }
.service-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: rgba(12,24,21,.72); }
.service-summary article { min-height: 76px; display: flex; align-items: center; gap: 13px; padding: 14px 20px; border-left: 1px solid var(--line); }
.service-summary article:first-child { border-left: 0; }
.service-summary strong, .service-summary small { display: block; }
.service-summary strong { font-size: 23px; line-height: 1; font-weight: 620; }
.service-summary small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.summary-marker { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px rgba(145,170,161,.07); }
.summary-marker.enabled { background: var(--green); box-shadow: 0 0 0 5px rgba(119,229,181,.08); }
.summary-marker.available { background: var(--green); box-shadow: 0 0 0 5px rgba(119,229,181,.08); }
.summary-marker.audit { background: var(--amber); box-shadow: 0 0 0 5px rgba(242,200,121,.08); }
.services-page .workspace-grid { grid-template-columns: minmax(320px, .72fr) minmax(600px, 1.55fr); gap: 16px; }
.services-page .inventory-panel, .services-page .detail-panel, .services-page .audit-panel { padding: 22px; }
.services-page .inventory-panel { position: sticky; top: 92px; }
.services-page .detail-panel { min-height: 620px; }
.services-page .panel-header { margin-bottom: 16px; }
.services-page .panel-header .panel-copy { margin: 5px 0 0; font-size: 11px; }
.capability-search { position: relative; display: block; }
.capability-search > span { position: absolute; top: 50%; left: 13px; z-index: 1; color: var(--muted); font-size: 18px; transform: translateY(-54%); pointer-events: none; }
.capability-search input { height: 42px; padding-left: 39px; background: rgba(5,13,12,.54); }
.services-page .filter-row { gap: 5px; margin-top: 12px; padding-bottom: 12px; }
.services-page .filter { flex: 1 1 auto; padding: 8px 7px; white-space: nowrap; }
.capability-list-header { display: grid; grid-template-columns: 38px minmax(0, 1fr) 56px 78px; gap: 10px; padding: 10px 12px 0; color: #607970; font: 8px/1.2 monospace; letter-spacing: .08em; }
.capability-list-header span:first-child { grid-column: 1 / 3; }
.capability-list-header span:not(:first-child) { text-align: right; }
.services-page .capability-list { max-height: 590px; margin-top: 7px; }
.services-page .capability-card { min-height: 66px; grid-template-columns: 38px minmax(0, 1fr) 56px 78px; gap: 10px; padding: 11px 12px; }
.services-page .capability-card.selected { border-color: rgba(119,229,181,.35); box-shadow: inset 3px 0 0 rgba(119,229,181,.6); }
.capability-card-status { min-width: 56px; display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; color: var(--muted); }
.capability-card-status small { margin: 0; font-size: 10px; }
.capability-availability { min-width: 0; display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.capability-availability::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: #607970; }
.capability-availability.available { color: var(--green); }
.capability-availability.available::before { background: var(--green); box-shadow: 0 0 0 4px rgba(119,229,181,.07); }
.capability-availability.degraded, .capability-availability.pending_permission { color: var(--amber); }
.capability-availability.degraded::before, .capability-availability.pending_permission::before { background: var(--amber); }
.capability-availability.unavailable, .capability-availability.permission_denied, .capability-availability.runtime_missing { color: var(--red); }
.capability-availability.unavailable::before, .capability-availability.permission_denied::before, .capability-availability.runtime_missing::before { background: var(--red); }
.capability-availability.unverified { color: var(--blue); }
.capability-availability.unverified::before { background: var(--blue); }
.detail-kind-label { display: inline-flex; margin: 0 0 8px; padding: 5px 8px; border-radius: 7px; color: var(--green); background: rgba(119,229,181,.08); font-size: 10px; font-weight: 700; }
.services-page .detail-heading h2 { font-size: 26px; }
.services-page .detail-description { min-height: 22px; margin: 0; }
.services-page .metadata { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0 12px; }
.services-page .metadata div { padding: 12px; }
.services-page .metadata dt { text-transform: none; letter-spacing: .04em; }
.services-page .metadata dd { font-family: inherit; font-size: 12px; font-weight: 600; }
#detail-health[data-health="healthy"] { color: var(--green); }
#detail-health[data-health="degraded"] { color: var(--amber); }
#detail-health[data-health="unavailable"] { color: var(--red); }
.capability-edit-link { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 18px; color: var(--muted); text-decoration: none; font-size: 11px; }
.capability-edit-link:hover { color: var(--green); }
.services-page .action-row { gap: 8px; }
.services-page .action-row .button { min-height: 42px; }
.services-page .subsection { margin-top: 22px; padding-top: 19px; }
.skill-instructions-section .subsection-title { align-items: flex-start; }
.skill-instructions-section .subsection-title > div { min-width: 0; }
.skill-instructions-section .subsection-title p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.skill-instructions-section pre { max-height: 560px; margin: 0; overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: 11px; color: #d6e7e0; background: #07100e; font: 11px/1.68 "SFMono-Regular", Consolas, "Liberation Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-gutter: stable; }
.services-page .permission-help { margin-bottom: 10px; }
.services-page .test-box { margin-left: 0; margin-right: 0; padding: 19px; border: 1px solid var(--line); background: rgba(5,13,12,.42); }
.services-page .test-box .result-view { margin-bottom: 0; }
.services-page .manifest-details { padding-top: 2px; }
.services-page .manifest-details summary { width: fit-content; padding: 7px 0; }
.services-page .manifest-details > .button { margin: 2px 0 10px; }
.technical-id { display: grid; gap: 6px; margin: 10px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 10px; }
.technical-id code { color: #c7ded5; overflow-wrap: anywhere; }
.services-page .audit-panel { margin-top: 16px; }
.services-page .audit-panel .panel-header { margin-bottom: 6px; }
.services-page .audit-item { grid-template-columns: 150px 130px minmax(160px, 1fr) auto; }
.audit-capability { overflow: hidden; color: #c9d9d3 !important; text-overflow: ellipsis; white-space: nowrap; }

.audit-page-shell { width: min(1080px, calc(100% - 48px)); padding-top: 40px; }
.audit-page-heading { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 26px; }
.audit-page-heading .eyebrow { margin-bottom: 7px; }
.audit-page-heading h1 { font-size: clamp(38px, 4vw, 54px); line-height: 1; }
.audit-page-heading > div > p:last-child { margin: 13px 0 0; color: var(--muted); font-size: 14px; }
.audit-back-link { min-height: 42px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.audit-controls { padding: 20px; }
.audit-controls-topline { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.audit-controls-topline h2 { margin: 0; font-size: 20px; }
.audit-controls-topline p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.audit-search { position: relative; display: block; margin-top: 16px; }
.audit-search > span { position: absolute; top: 50%; left: 13px; z-index: 1; color: var(--muted); font-size: 18px; transform: translateY(-54%); pointer-events: none; }
.audit-search input { height: 44px; padding-left: 39px; background: rgba(5,13,12,.54); }
.audit-filter-row { display: flex; gap: 6px; margin-top: 12px; }
.audit-filter-row .filter { min-width: 82px; }
.audit-record-panel { margin-top: 14px; padding: 4px 22px; }
.audit-record-list { display: grid; }
.audit-record { min-height: 88px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 15px; align-items: center; padding: 16px 3px; border-top: 1px solid var(--line); }
.audit-record:first-child { border-top: 0; }
.audit-record-marker { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 6px rgba(139,188,255,.07); }
.audit-record.validation .audit-record-marker { background: var(--green); box-shadow: 0 0 0 6px rgba(119,229,181,.07); }
.audit-record.permission .audit-record-marker { background: var(--amber); box-shadow: 0 0 0 6px rgba(242,200,121,.07); }
.audit-record.invocation .audit-record-marker { background: #a996ff; box-shadow: 0 0 0 6px rgba(169,150,255,.08); }
.audit-record.other .audit-record-marker { background: var(--muted); }
.audit-record-copy { min-width: 0; }
.audit-record-copy > div { display: flex; align-items: center; gap: 9px; }
.audit-record-copy strong { font-size: 14px; }
.audit-record-copy > div > span { padding: 4px 7px; border-radius: 6px; color: var(--muted); background: rgba(145,170,161,.08); font-size: 9px; }
.audit-record-copy p { overflow: hidden; margin: 7px 0 5px; color: #d6e7e0; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.audit-record-copy small { color: var(--muted); font-size: 10px; }
.audit-empty-state { min-height: 300px; display: grid; place-content: center; justify-items: center; text-align: center; }
.audit-empty-state > span { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--green); font-size: 20px; }
.audit-empty-state strong { font-size: 17px; }
.audit-empty-state p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

/* Execution Trace ------------------------------------------------------- */
.trace-page { background: radial-gradient(circle at 70% -10%, #163b33 0, var(--bg) 31rem); }
.trace-page-shell { width: min(1560px, calc(100% - 40px)); padding-top: 30px; }
.trace-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 22px; }
.trace-heading > div { min-width: 0; }
.trace-heading h1 { margin: 0; font-size: clamp(36px, 4vw, 52px); line-height: 1; }
.trace-heading > div:first-child > p:last-child { max-width: 700px; margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.trace-heading-actions { display: flex; align-items: center; gap: 10px; }
.trace-heading-actions .button { display: inline-flex; align-items: center; gap: 7px; }
.trace-admin-badge { padding: 8px 11px; border: 1px solid rgba(139,188,255,.2); border-radius: 9px; color: var(--blue); background: rgba(139,188,255,.06); font: 600 10px/1 monospace; letter-spacing: .06em; }
.trace-workspace { display: grid; grid-template-columns: 310px minmax(0,1fr); gap: 16px; align-items: start; }
.trace-workspace > *, .trace-content > *, .trace-flow-panel { min-width: 0; }
.trace-run-panel { position: sticky; top: 92px; max-height: calc(100vh - 112px); display: flex; flex-direction: column; overflow: hidden; padding: 18px; }
.trace-main, .trace-content { min-width: 0; }
.trace-content { display: grid; gap: 16px; }
.trace-empty[hidden], .trace-content[hidden], .trace-detail-backdrop[hidden], .trace-json-section[hidden] { display: none !important; }
.trace-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.trace-panel-heading h2, .trace-panel-heading p { margin: 0; }
.trace-panel-heading h2 { font-size: 17px; font-weight: 620; letter-spacing: -.015em; }
.trace-panel-heading p { margin-top: 5px; color: var(--muted); font-size: 11px; }
.trace-count { min-width: 30px; padding: 5px 8px; border-radius: 7px; color: var(--green); background: rgba(119,229,181,.08); font: 700 11px/1 monospace; text-align: center; }
.trace-search { position: relative; display: block; margin-bottom: 13px; }
.trace-search > span { position: absolute; top: 50%; left: 12px; color: var(--muted); font-size: 16px; transform: translateY(-52%); }
.trace-search input { width: 100%; height: 41px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(4,12,10,.55); font-size: 12px; outline: none; }
.trace-search input:focus { border-color: rgba(119,229,181,.42); box-shadow: 0 0 0 3px rgba(119,229,181,.06); }
.trace-run-list { min-height: 210px; display: grid; align-content: start; gap: 7px; overflow-y: auto; padding-right: 3px; scrollbar-width: thin; }
.trace-run-item { width: 100%; min-width: 0; display: grid; gap: 8px; padding: 13px; border: 1px solid transparent; border-radius: 11px; color: var(--text); background: rgba(255,255,255,.022); text-align: left; transition: border-color .14s ease, background .14s ease; }
.trace-run-item:hover { border-color: rgba(119,229,181,.2); background: rgba(119,229,181,.04); }
.trace-run-item.active { border-color: rgba(119,229,181,.38); background: linear-gradient(90deg, rgba(119,229,181,.095), rgba(119,229,181,.035)); box-shadow: inset 3px 0 var(--green); }
.trace-run-item-head, .trace-run-item-meta { min-width: 0; display: flex; align-items: center; gap: 8px; }
.trace-run-item-head { justify-content: space-between; }
.trace-run-item-head strong { overflow: hidden; font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.trace-run-item-head i, .trace-status { flex: 0 0 auto; padding: 4px 7px; border-radius: 6px; color: var(--muted); background: rgba(145,170,161,.1); font-size: 10px; font-style: normal; }
.trace-run-item-head i[data-status="succeeded"], .trace-status[data-status="succeeded"] { color: var(--green); background: rgba(119,229,181,.09); }
.trace-run-item-head i[data-status="failed"], .trace-run-item-head i[data-status="cancelled"], .trace-status[data-status="failed"], .trace-status[data-status="cancelled"] { color: var(--red); background: rgba(255,126,126,.09); }
.trace-run-item-head i[data-status="running"], .trace-run-item-head i[data-status="waiting_authorization"], .trace-status[data-status="running"], .trace-status[data-status="waiting_authorization"] { color: var(--amber); background: rgba(242,200,121,.09); }
.trace-run-prompt { overflow: hidden; color: #c1d2cc; font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.trace-run-item-meta { color: #61776f; font-size: 9px; }
.trace-run-item-meta code { margin-left: auto; color: #6f8980; font-size: 9px; }
.trace-empty { min-height: 440px; display: grid; place-content: center; justify-items: center; padding: 50px; color: var(--muted); text-align: center; }
.trace-empty-icon { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgba(119,229,181,.25); border-radius: 15px; color: var(--green); background: rgba(119,229,181,.055); font-size: 23px; }
.trace-empty h2 { margin: 19px 0 7px; color: var(--text); font-size: 20px; }
.trace-empty p { max-width: 390px; margin: 0; font-size: 13px; line-height: 1.65; }
.trace-overview-panel, .trace-usage-panel, .trace-flow-panel, .trace-timeline-panel { padding: 21px; }
.trace-conversation-panel { min-width: 0; padding: 21px; }
.trace-conversation-panel .trace-panel-heading h2 { overflow-wrap: anywhere; }
.trace-conversation-total { flex: 0 0 auto; text-align: right; }
.trace-conversation-total span { display: block; color: var(--muted); font-size: 10px; }
.trace-conversation-total strong { display: block; margin-top: 5px; font-size: 20px; color: var(--green); font-variant-numeric: tabular-nums; }
.trace-conversation-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 15px; color: var(--muted); font-size: 10px; }
.trace-conversation-meta code { overflow-wrap: anywhere; color: #789489; }
.trace-turn-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.trace-turn-item { min-width: 0; display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-align: left; background: rgba(255,255,255,.025); }
.trace-turn-item:hover { background: rgba(119,229,181,.045); }
.trace-turn-item.active { border-color: rgba(119,229,181,.48); background: rgba(119,229,181,.07); box-shadow: inset 3px 0 var(--green); }
.trace-turn-item:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.trace-turn-heading { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 11px; }
.trace-turn-heading small, .trace-turn-meta { color: var(--muted); font-size: 10px; }
.trace-turn-heading small[data-status="failed"] { color: var(--red); }
.trace-turn-prompt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.trace-conversation-panel > .button { margin-top: 12px; }
.trace-overview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.trace-title-row { display: flex; align-items: center; gap: 10px; }
.trace-title-row h2 { overflow: hidden; margin: 0; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.trace-overview-heading code { display: block; margin-top: 7px; color: #6f8980; font-size: 10px; }
.trace-overview-heading time { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.trace-prompt { margin: 18px 0; padding: 13px 15px; border-left: 2px solid rgba(119,229,181,.55); border-radius: 0 9px 9px 0; color: #cbdcd6; background: rgba(119,229,181,.035); font-size: 12px; line-height: 1.65; }
.trace-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 11px; }
.trace-metrics > div { min-width: 0; padding: 12px 14px; border-left: 1px solid var(--line); background: rgba(5,14,12,.32); }
.trace-metrics > div:first-child { border-left: 0; }
.trace-metrics > div:nth-child(5) { border-left: 0; }
.trace-metrics > div:nth-child(n+5) { border-top: 1px solid var(--line); }
.trace-metrics span, .trace-metrics strong { display: block; }
.trace-metrics span { color: var(--muted); font-size: 9px; }
.trace-metrics strong { margin-top: 6px; overflow: hidden; color: #d9e9e3; font-size: 15px; font-weight: 620; text-overflow: ellipsis; }
.trace-model-usage { display: grid; gap: 7px; }
.trace-usage-empty { margin: 0; padding: 22px; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); font-size: 11px; text-align: center; }
.trace-usage-row { position: relative; display: grid; grid-template-columns: minmax(150px,1.25fr) minmax(180px,2fr) repeat(3,minmax(72px,.65fr)); gap: 14px; align-items: center; overflow: hidden; min-height: 58px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(5,14,12,.35); text-align: left; }
.trace-usage-row:hover, .trace-usage-row.selected { border-color: rgba(139,188,255,.48); background: rgba(139,188,255,.055); }
.trace-usage-copy, .trace-usage-value { position: relative; z-index: 1; min-width: 0; }
.trace-usage-copy { display: grid; gap: 4px; }
.trace-usage-copy strong { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.trace-usage-copy small, .trace-usage-value span { color: var(--muted); font-size: 9px; }
.trace-usage-bar { position: relative; z-index: 1; height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.045); }
.trace-usage-bar i { display: block; width: var(--usage-width,0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--green)); box-shadow: 0 0 14px rgba(119,229,181,.18); }
.trace-usage-value { display: grid; gap: 3px; }
.trace-usage-value strong { font: 650 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; }
.trace-flow-legend { color: #698078; font: 10px/1.4 monospace; }
.trace-flow { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,12,10,.36); }
.trace-flow-row { display: grid; grid-template-columns: 58px minmax(0,1fr); border-top: 1px solid var(--line); }
.trace-flow-row:first-child { border-top: 0; }
.trace-flow-sequence { display: grid; place-items: center; border-right: 1px solid var(--line); color: #60766e; background: rgba(255,255,255,.012); font: 700 9px/1 monospace; letter-spacing: .05em; }
.trace-flow-track { min-width: 0; display: flex; align-items: stretch; padding: 12px; }
.trace-flow-node { min-width: 0; flex: 1 1 0; display: grid; grid-template-columns: 36px minmax(0,1fr); gap: 10px; align-items: center; min-height: 68px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(10,24,21,.9); text-align: left; transition: border-color .14s ease, background .14s ease, transform .14s ease; }
.trace-flow-node:not(:disabled):hover, .trace-flow-node.selected { border-color: rgba(119,229,181,.62); background: rgba(119,229,181,.075); transform: translateY(-1px); }
.trace-flow-node:disabled { cursor: default; }
.trace-flow-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #07100e; background: var(--muted); font: 800 10px/1 monospace; }
.trace-flow-node.agent .trace-flow-icon { background: var(--green); }
.trace-flow-node.model .trace-flow-icon { background: linear-gradient(135deg, var(--blue), #b3a5ff); }
.trace-flow-node.skill .trace-flow-icon { background: #b3a5ff; }
.trace-flow-node.mcp .trace-flow-icon { background: var(--blue); }
.trace-flow-node.tool .trace-flow-icon { background: var(--amber); }
.trace-flow-node.result .trace-flow-icon { background: #7adcc2; }
.trace-flow-node.error .trace-flow-icon { color: #fff; background: var(--red); }
.trace-flow-copy { min-width: 0; display: grid; gap: 3px; }
.trace-flow-copy small { color: #698078; font: 700 8px/1.2 monospace; letter-spacing: .08em; }
.trace-flow-copy strong { overflow: hidden; font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.trace-flow-copy em { overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.trace-flow-edge { position: relative; width: 54px; flex: 0 0 54px; display: grid; place-items: center; color: #617970; }
.trace-flow-edge > span { width: 100%; height: 1px; background: linear-gradient(90deg, rgba(119,229,181,.16), rgba(119,229,181,.6)); }
.trace-flow-edge > span::after { content: ""; position: absolute; top: 50%; right: 3px; width: 6px; height: 6px; border-top: 1px solid var(--green); border-right: 1px solid var(--green); transform: translateY(-50%) rotate(45deg); }
.trace-flow-edge small { position: absolute; top: 7px; color: #536960; font-size: 8px; }
.trace-timeline-heading { flex-wrap: wrap; gap: 12px; }
.trace-timeline-modes { display: flex; flex-wrap: wrap; max-width: 100%; flex-shrink: 1; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.15); }
.trace-timeline-modes button { padding: 7px 11px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 11px; }
.trace-timeline-modes button[aria-pressed="true"] { color: var(--green); background: rgba(119,229,181,.12); }
.trace-timeline-warning { color: var(--amber); font-size: 12px; line-height: 1.6; }
.trace-timeline { max-height: 660px; overflow-y: auto; padding: 2px 5px 0 7px; scrollbar-width: thin; overflow-anchor: none; }
.trace-step { position: relative; display: grid; grid-template-columns: 13px minmax(0,1fr); gap: 12px; padding: 4px 0 18px; }
.trace-step::before { content: ""; position: absolute; top: 12px; bottom: -4px; left: 5px; width: 1px; background: var(--line); }
.trace-step:last-child::before { display: none; }
.trace-step-marker { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 4px; border: 2px solid #11241f; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(119,229,181,.08); }
.trace-step-error .trace-step-marker { background: var(--red); box-shadow: 0 0 0 3px rgba(255,126,126,.08); }
.trace-step-error strong { color: var(--red); }
.trace-step-copy { min-width: 0; }
.trace-step-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.trace-step strong { font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.trace-step-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; }
.trace-step time, .trace-step code, .trace-step-meta small { color: #90a69d; font-size: 10px; font-variant-numeric: tabular-nums; }
.trace-step p { margin: 9px 0 0; color: #c5d8cf; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.trace-step-text.collapsed { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.trace-text-expand { margin-top: 5px; padding: 4px 0; border: 0; color: var(--green); background: transparent; font-size: 11px; }
.trace-event-data { margin-top: 8px; }
.trace-event-data summary { width: fit-content; max-width: 100%; padding: 4px 0; color: #90a69d; cursor: pointer; font-size: 11px; }
.trace-event-data pre { max-height: 300px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: #c5d8cf; background: rgba(0,0,0,.22); font-size: 11px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.trace-timeline-modes button:focus-visible, .trace-text-expand:focus-visible, .trace-event-data summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.trace-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin: 0 0 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.trace-facts > div { min-width: 0; padding: 10px 12px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: rgba(5,14,12,.28); }
.trace-facts > div:nth-child(-n+2) { border-top: 0; }
.trace-facts > div:nth-child(odd) { border-left: 0; }
.trace-facts dt { color: var(--muted); font-size: 9px; }
.trace-facts dd { overflow-wrap: anywhere; margin: 5px 0 0; color: #d5e6df; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.45; }
.trace-json-section { margin-top: 14px; }
.trace-json-section > div { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.trace-json-section h3 { margin: 0; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.trace-json-section button { padding: 3px 7px; border: 0; border-radius: 5px; color: #6f8980; background: rgba(255,255,255,.035); font-size: 9px; }
.trace-json-section button:hover { color: var(--text); }
.trace-json-section pre { max-height: 310px; overflow: auto; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; color: #cfe1da; background: rgba(2,8,7,.72); font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; scrollbar-width: thin; }
#trace-request-evidence { margin-bottom: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
#trace-request-evidence[hidden] { display: none; }
#trace-request-evidence label { display: block; margin-bottom: 4px; }
#trace-request-evidence select { width: 100%; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel, #14201c); }
.trace-drawer-open { overflow: hidden; }
.trace-detail-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(1,7,6,.62); backdrop-filter: blur(3px); }
.trace-detail-drawer { position: fixed; inset: 0 0 0 auto; z-index: 71; width: min(680px, calc(100vw - 40px)); display: flex; flex-direction: column; border-left: 1px solid rgba(163,200,188,.24); color: var(--text); background: #0b1714; box-shadow: -28px 0 90px rgba(0,0,0,.48); visibility: hidden; transform: translateX(102%); transition: transform .2s ease, visibility .2s; }
.trace-detail-drawer.open { visibility: visible; transform: translateX(0); }
.trace-drawer-header { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); background: rgba(15,29,25,.96); }
.trace-drawer-heading { min-width: 0; display: flex; align-items: flex-start; gap: 13px; }
.trace-drawer-heading > div { min-width: 0; }
.trace-drawer-heading h2 { overflow: hidden; margin: 1px 0 7px; font-size: 20px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.trace-drawer-heading p { overflow: hidden; margin: 0; color: var(--muted); font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
.trace-detail-kind { flex: 0 0 auto; min-width: 43px; padding: 7px 8px; border: 1px solid rgba(119,229,181,.22); border-radius: 8px; color: var(--green); background: rgba(119,229,181,.07); font: 750 9px/1 monospace; text-align: center; letter-spacing: .06em; }
.trace-detail-kind[data-kind="skill"] { color: #c5bcff; border-color: rgba(179,165,255,.25); background: rgba(179,165,255,.08); }
.trace-detail-kind[data-kind="mcp"] { color: var(--blue); border-color: rgba(139,188,255,.25); background: rgba(139,188,255,.08); }
.trace-detail-kind[data-kind="tool"] { color: var(--amber); border-color: rgba(242,200,121,.25); background: rgba(242,200,121,.08); }
.trace-detail-kind[data-kind="model"] { color: var(--blue); border-color: rgba(139,188,255,.28); background: rgba(139,188,255,.08); }
.trace-detail-close { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 23px; line-height: 1; }
.trace-detail-close:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255,255,255,.055); }
.trace-drawer-toolbar { min-height: 52px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 26px; border-bottom: 1px solid var(--line); }
.trace-drawer-toolbar > span { color: var(--muted); font-size: 11px; }
.trace-drawer-toolbar > div { display: flex; gap: 6px; }
.trace-drawer-toolbar button, .trace-detail-tabs button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; }
.trace-drawer-toolbar button:hover:not(:disabled), .trace-detail-tabs button:hover { color: var(--text); background: rgba(255,255,255,.035); }
.trace-drawer-toolbar button:disabled { opacity: .32; cursor: default; }
.trace-detail-tabs { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 8px 26px; border-bottom: 1px solid var(--line); background: rgba(4,12,10,.38); }
.trace-detail-tabs button { min-height: 38px; }
.trace-detail-tabs button.active { color: var(--green); border-color: rgba(119,229,181,.3); background: rgba(119,229,181,.07); }
.trace-drawer-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 22px 26px 32px; overscroll-behavior: contain; scrollbar-width: thin; }
.trace-drawer-body .trace-json-section { margin-top: 0; }
.trace-drawer-body .trace-json-section pre { max-height: none; min-height: 240px; }

.onboarding-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; margin-top: 18px; align-items: start; }
.step-number { color: var(--green) !important; font: 700 20px/1 monospace !important; }
.stack-form, .stack-form label, .test-box label, .template-row label { display: grid; gap: 8px; }
.stack-form { gap: 14px; }
.stack-form label, .test-box label, .template-row label { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: #0a1513; padding: 11px 12px; }
input:focus, textarea:focus, select:focus { border-color: rgba(119,229,181,.55); box-shadow: 0 0 0 3px rgba(119,229,181,.07); }
textarea { resize: vertical; line-height: 1.55; }
.template-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-bottom: 14px; }

.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.upload-panel { padding: 24px; }
.tool-upload-panel { grid-column: 1 / -1; }
.tool-upload-panel form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.tool-upload-panel form > label:first-child, .tool-upload-panel form > .form-row, .tool-upload-panel form > label:nth-of-type(2), .tool-upload-panel form > pre, .tool-upload-panel form > button { grid-column: 1 / -1; }
.file-picker { position: relative; min-height: 86px; place-content: center; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--text) !important; background: rgba(119,229,181,.035); text-align: center; cursor: pointer; }
.file-picker:hover { border-color: rgba(119,229,181,.52); background: rgba(119,229,181,.065); }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-picker span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.file-preview, .selected-files { min-height: 116px; max-height: 260px; overflow: auto; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; color: #b7cdc4; background: #07100e; font: 11px/1.55 monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.selected-files { min-height: 80px; color: var(--muted); }
.or-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.or-divider::before, .or-divider::after { content: ""; height: 1px; background: var(--line); }
.import-result-panel { margin-top: 18px; padding: 24px; scroll-margin-top: 96px; }
.import-result-list { display: grid; gap: 9px; }
.import-result-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); text-decoration: none; background: rgba(255,255,255,.018); }
.import-result-item:hover { border-color: rgba(119,229,181,.42); }
.import-result-item span { color: var(--muted); font-size: 11px; }
.import-warning { margin: 0; padding: 11px 13px; border-left: 2px solid var(--amber); color: var(--muted); background: rgba(242,200,121,.055); font-size: 12px; }

.import-page-shell { width: min(1240px, calc(100% - 48px)); padding-top: 40px; }
.import-hero { display: flex; align-items: center; justify-content: space-between; gap: 36px; margin-bottom: 24px; }
.import-hero h1 { margin: 0; font-size: clamp(36px, 4vw, 54px); font-weight: 620; line-height: 1.05; letter-spacing: -.04em; }
.import-hero .hero-copy { max-width: 680px; margin-top: 15px; font-size: 14px; line-height: 1.65; }
.import-safety-note { min-width: 300px; display: flex; align-items: center; gap: 13px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(119,229,181,.035); }
.import-safety-note .status-dot { flex: 0 0 auto; }
.import-safety-note strong, .import-safety-note small { display: block; }
.import-safety-note strong { font-size: 12px; font-weight: 600; }
.import-safety-note small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.import-kind-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: rgba(8,18,16,.7); }
.import-kind-tab { min-width: 0; min-height: 70px; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); background: transparent; text-align: left; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.import-kind-tab:hover { color: var(--text); background: rgba(255,255,255,.025); }
.import-kind-tab.active { color: var(--text); border-color: rgba(119,229,181,.25); background: rgba(119,229,181,.075); }
.import-kind-tab > span:last-child { min-width: 0; }
.import-kind-tab strong, .import-kind-tab small { display: block; }
.import-kind-tab strong { font-size: 13px; font-weight: 620; }
.import-kind-tab small { margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #738c83; font-size: 10px; }
.import-kind-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); font: 700 9px/1 monospace; }
.import-kind-tab.active .import-kind-icon { border-color: rgba(119,229,181,.32); color: var(--green); background: rgba(119,229,181,.08); }
.import-kind-panels { display: grid; }
.import-kind-panel { min-width: 0; padding: 30px; box-shadow: 0 22px 70px rgba(0,0,0,.2); }
.import-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 22px; }
.import-panel-heading h2 { margin: 0; font-size: 24px; font-weight: 620; letter-spacing: -.025em; }
.import-panel-heading p:last-child { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.safe-state { flex: 0 0 auto; padding: 6px 9px; border: 1px solid rgba(242,200,121,.22); border-radius: 999px; color: var(--amber); background: rgba(242,200,121,.055); font-size: 9px; }
.mcp-method-tabs { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4,12,10,.35); }
.mcp-method-tab { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; }
.mcp-method-tab:hover { color: var(--text); }
.mcp-method-tab.active { color: var(--text); border-color: var(--line); background: var(--surface-soft); }
.mcp-method-tab strong { font-weight: 580; }
.mcp-method-tab span { padding: 3px 5px; border-radius: 5px; color: var(--green); background: rgba(119,229,181,.09); font-size: 8px; }
.mcp-method-panel { margin-top: 18px; }
.mcp-json-form { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .5fr); gap: 18px; align-items: stretch; }
.mcp-json-editor, .mcp-json-guide { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.field-heading label { color: var(--text); font-size: 12px; font-weight: 600; }
.field-heading span { color: var(--muted); font-size: 9px; }
#mcp-json-input { min-height: 330px; resize: vertical; color: #d9e9e3; background: #06100e; font: 12px/1.62 "SFMono-Regular", Consolas, monospace; tab-size: 2; }
#mcp-json-input::placeholder { color: #536b63; opacity: .72; }
.json-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; }
.compact-button { min-height: 31px; padding: 0 10px; font-size: 9px; }
.json-file-button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.json-file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.json-file-name { min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #617970; font-size: 9px; }
.mcp-json-guide { display: flex; flex-direction: column; gap: 14px; }
.json-validation-status { display: grid; grid-template-columns: 10px 1fr; gap: 10px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.018); }
.json-validation-status > span { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(242,200,121,.07); }
.json-validation-status.valid { border-color: rgba(119,229,181,.25); background: rgba(119,229,181,.04); }
.json-validation-status.valid > span { background: var(--green); box-shadow: 0 0 0 4px rgba(119,229,181,.07); }
.json-validation-status.invalid { border-color: rgba(255,140,131,.25); background: rgba(255,140,131,.04); }
.json-validation-status.invalid > span { background: var(--red); box-shadow: 0 0 0 4px rgba(255,140,131,.07); }
.json-validation-status strong, .json-validation-status small { display: block; }
.json-validation-status strong { font-size: 11px; font-weight: 600; }
.json-validation-status small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; overflow-wrap: anywhere; }
.json-guide-copy { padding: 2px 3px; }
.json-guide-copy > strong { font-size: 11px; font-weight: 600; }
.json-guide-copy ul { display: grid; gap: 8px; margin: 11px 0 0; padding-left: 18px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.json-guide-copy code { color: #b9f5d9; }
.import-boundary-note { margin: 0; padding: 11px 12px; border-left: 2px solid var(--amber); color: #8fa49d; background: rgba(242,200,121,.035); font-size: 9px; line-height: 1.55; }
.import-primary-action { min-height: 42px; font-size: 12px; }
.mcp-json-guide .import-primary-action { width: 100%; margin-top: auto; }
.method-intro { display: flex; align-items: baseline; gap: 10px; padding: 2px 2px 14px; }
.method-intro strong { font-size: 13px; }
.method-intro span { color: var(--muted); font-size: 10px; }
.focused-import-form { max-width: 940px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); }
.local-source-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.local-source-grid .file-picker { min-height: 105px; padding: 15px; }
.form-helper { margin: -4px 0 2px; color: #6f877f; font-size: 10px; line-height: 1.5; }
.import-kind-panel.tool-upload-panel { grid-column: auto; }
.import-kind-panel.tool-upload-panel .focused-import-form { width: 100%; max-width: 1040px; display: grid; grid-template-columns: 1fr; }
.import-kind-panel.tool-upload-panel .focused-import-form > * { grid-column: 1 / -1; }
.import-kind-panel .selected-files { min-height: 68px; }
.skill-update-preview { display: grid; gap: 12px; padding: 16px; border: 1px solid rgba(242,200,121,.27); border-radius: 12px; background: rgba(242,200,121,.045); }
.skill-update-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.skill-update-preview-heading > div { display: grid; gap: 3px; }
.skill-update-preview-heading span { color: var(--amber); font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.skill-update-preview-heading strong { font-size: 14px; }
.skill-update-preview-heading small { color: var(--muted); font-size: 10px; }
.skill-update-preview > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.skill-update-preview ul { display: grid; gap: 6px; max-height: 190px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.skill-update-preview li { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; color: #c5d8d1; background: rgba(4,12,10,.38); font: 10px/1.4 monospace; }
.skill-update-preview li span { color: var(--muted); font: 700 9px/1.4 sans-serif; }
.skill-update-preview li.added span { color: var(--green); }
.skill-update-preview li.modified span { color: var(--amber); }
.skill-update-preview li.removed span { color: var(--red); }
.skill-update-preview .skill-preview-note { padding-top: 2px; color: #9a8d6e; font-size: 9px; }

.model-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.model-config-grid > .panel, .playground-panel { padding: 24px; }
.model-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.model-page-heading h1 { font-size: clamp(36px, 4vw, 58px); }
.model-page-heading > div > p:last-child { margin: 13px 0 0; color: var(--muted); line-height: 1.6; }
.model-management-grid { display: grid; grid-template-columns: minmax(560px, 1fr) minmax(320px, 400px); gap: 18px; align-items: start; }
.unified-model-config, .configured-models-panel { min-width: 0; padding: 26px; }
.config-form-section { display: grid; gap: 14px; padding: 23px 0; border-top: 1px solid var(--line); }
.config-form-section:first-of-type { padding-top: 2px; border-top: 0; }
.config-section-heading { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; margin-bottom: 2px; }
.config-section-heading > span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(119,229,181,.32); border-radius: 10px; color: var(--green); background: rgba(119,229,181,.06); font: 700 10px/1 monospace; }
.config-section-heading h3 { margin: 1px 0 4px; font-size: 15px; }
.config-section-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.advanced-config-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; list-style: none; cursor: pointer; }
.advanced-config-summary::-webkit-details-marker { display: none; }
.advanced-config-summary::after { content: "展开"; flex: 0 0 auto; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--green); font-size: 11px; }
.advanced-config-section[open] .advanced-config-summary::after { content: "收起"; }
.advanced-config-summary .config-section-heading { flex: 1; margin-bottom: 0; }
.advanced-config-content { display: grid; gap: 14px; padding-top: 18px; }
.model-enable-control { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(119,229,181,.025); }
.save-configuration { width: 100%; min-height: 46px; }
.new-model-button { width: 100%; }
.configured-models-panel .model-list { margin-top: 16px; padding-top: 16px; }
.type-specific-fields { display: grid; gap: 14px; }
.type-specific-fields[hidden], .advanced-config-section[hidden] { display: none; }
.model-type-group { display: grid; gap: 9px; }
.model-type-group + .model-type-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.model-type-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.model-type-group-heading strong { color: var(--green); font: 700 11px/1.3 monospace; letter-spacing: .08em; }
.model-type-group-heading span { color: var(--muted); font-size: 10px; }
.model-item-title { display: flex; min-width: 0; align-items: center; gap: 8px; }
.model-item-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-type-chip { flex: 0 0 auto; padding: 4px 7px; border: 1px solid rgba(119,229,181,.25); border-radius: 7px; color: var(--green); background: rgba(119,229,181,.06); font: 700 9px/1 monospace; }
input[readonly] { color: var(--muted); background: rgba(7,16,14,.72); cursor: not-allowed; }
.setup-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.setup-guide.two-step-guide { grid-template-columns: repeat(2, 1fr); }
.setup-guide article { display: flex; align-items: center; gap: 13px; min-height: 86px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(13,24,22,.74); }
.setup-guide article > span, .setup-step { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(119,229,181,.34); border-radius: 50%; color: var(--green); background: rgba(119,229,181,.07); font: 600 12px/1 monospace; }
.setup-guide strong, .setup-guide small { display: block; }
.setup-guide strong { margin-bottom: 5px; font-size: 13px; }
.setup-guide small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.settings-sections { display: grid; gap: 18px; }
.settings-section { padding: 26px; }
.settings-heading { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin-bottom: 22px; }
.settings-heading h2, .settings-form-card h3, .settings-list-card h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
.settings-heading h2 { font-size: 22px; }
.settings-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.count-badge { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; }
.settings-layout { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 16px; align-items: start; }
.single-provider-layout { display: block; }
.single-provider-card form { max-width: 920px; }
.settings-form-card, .settings-list-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); }
.settings-form-card h3, .settings-list-card h3 { margin-bottom: 17px; font-size: 15px; }
.settings-form-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.settings-form-header h3 { margin-bottom: 0; }
.settings-list-card .model-list { margin-top: 14px; padding-top: 14px; }
.settings-hint { margin: -8px 0 4px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.settings-empty { display: grid; place-content: center; min-height: 150px; padding: 20px; text-align: center; border: 1px dashed var(--line); border-radius: 11px; color: var(--muted); }
.settings-empty strong, .settings-empty span { display: block; }
.settings-empty strong { margin-bottom: 7px; color: var(--text); font-size: 13px; }
.settings-empty span { font-size: 11px; line-height: 1.5; }
.advanced-settings { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.08); }
.advanced-settings summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.advanced-settings[open] summary { margin-bottom: 13px; color: var(--text); }
.mcp-import-mode { margin-top: 16px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.018); }
.import-mode-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 15px; }
.import-mode-heading > span { min-width: 48px; padding: 6px 8px; border: 1px solid rgba(119,229,181,.3); border-radius: 7px; color: var(--green); text-align: center; font: 600 10px/1 monospace; }
.import-mode-heading strong, .import-mode-heading small { display: block; }
.import-mode-heading strong { font-size: 13px; }
.import-mode-heading small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.legacy-import { margin-top: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; }
.legacy-import summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.legacy-import[open] summary { margin-bottom: 13px; color: var(--text); }
.three-column-row { grid-template-columns: repeat(3, 1fr); }
.stack-form label small { color: var(--muted); font-size: 10px; }
.model-list { display: grid; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.model-item { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018); }
.model-item.selectable { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.model-item.selectable:hover, .model-item.selectable.selected { border-color: var(--line-strong); background: rgba(119,229,181,.045); }
.model-item.default-model { border-color: rgba(119,229,181,.36); background: rgba(119,229,181,.045); }
.model-item-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.model-item-heading span { padding: 4px 7px; border-radius: 7px; font-size: 10px; }
.state-enabled { color: var(--green); background: rgba(119,229,181,.1); }
.state-disabled { color: var(--muted); background: rgba(145,170,161,.1); }
.model-item-meta { margin: 10px 0 12px; color: var(--muted); font: 11px/1.55 monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.model-item-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.model-item-actions .button { min-height: 32px; padding: 0 10px; font-size: 11px; }
.button.danger-text { color: var(--red); }
.playground-panel { margin-top: 18px; }
.direct-chat-page { max-width: 1120px; }
.direct-chat-panel { margin-top: 0; padding: 28px; }
.chat-heading-copy { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.direct-chat-panel .chat-messages { min-height: 500px; }
.playground-toolbar { display: grid; grid-template-columns: minmax(260px, .7fr) 1fr; gap: 14px; align-items: end; margin-bottom: 16px; }
.playground-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.active-model { min-height: 62px; display: flex; flex-direction: column; justify-content: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(119,229,181,.035); }
.active-model span { color: var(--muted); font-size: 10px; }
.active-model strong { margin-top: 5px; color: var(--green); font: 12px/1.4 monospace; }
.chat-messages { min-height: 320px; max-height: 620px; overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #07100e; }
.chat-empty { min-height: 280px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.chat-empty strong, .chat-empty span { display: block; }
.chat-empty strong { color: var(--text); margin-bottom: 7px; }
.chat-message { max-width: 82%; margin-bottom: 14px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.chat-message.user { margin-left: auto; background: rgba(139,188,255,.08); border-color: rgba(139,188,255,.2); }
.chat-role { display: block; margin-bottom: 7px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.chat-message.user .chat-role { color: var(--blue); }
.chat-content { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; font-size: 14px; }
.chat-meta { display: block; margin-top: 9px; color: var(--muted); font: 10px/1.5 monospace; }
.chat-form { display: grid; gap: 12px; margin-top: 14px; }
.chat-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.chat-page { height: 100vh; height: 100dvh; overflow: hidden; background: #07100e; }
.chat-page .ambient { opacity: .09; }
.chat-page .ambient-one { right: 16vw; }
.chat-page .topbar { height: 64px; background: rgba(7,16,14,.9); }
.chat-page .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
.chat-page .brand strong { font-size: 14px; }
.chat-page .brand small { font-size: 9px; }
.chat-shell { height: calc(100vh - 64px); height: calc(100dvh - 64px); min-height: 0; display: grid; grid-template-columns: 238px minmax(0, 1fr); gap: 24px; overflow: hidden; padding: 0 max(18px, calc((100vw - 1480px) / 2)); position: relative; z-index: 1; }
.session-sidebar { min-height: 0; display: flex; flex-direction: column; padding: 18px 13px 18px 0; border-right: 1px solid rgba(163,200,188,.1); }
.session-sidebar-header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 7px 15px; }
.session-sidebar-header span, .session-sidebar-header strong { display: block; }
.session-sidebar-header span { margin-bottom: 4px; color: #607970; font: 700 8px/1 monospace; letter-spacing: .13em; text-transform: uppercase; }
.session-sidebar-header strong { font-size: 13px; font-weight: 620; }
.session-sidebar-actions { display: flex; align-items: center; gap: 7px; }
.chat-history-close, .chat-history-toggle, .chat-session-scrim { display: none; }
.session-new-button { width: 32px; height: 32px; flex: 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--green); background: rgba(255,255,255,.025); font-size: 18px; font-weight: 300; }
.session-new-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.session-list { flex: 1 1 auto; min-height: 0; display: grid; align-content: start; gap: 5px; overflow-y: auto; padding: 0 4px 10px 0; scrollbar-color: rgba(145,170,161,.2) transparent; }
.session-list-empty { margin: 0; padding: 18px 8px; color: #607970; font-size: 10px; line-height: 1.55; }
.session-entry { min-width: 0; position: relative; }
.session-item { width: 100%; display: grid; gap: 7px; padding: 11px 44px 11px calc(10px + var(--session-depth, 0) * 12px); border: 1px solid transparent; border-radius: 11px; color: #b8ccc5; background: transparent; text-align: left; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.session-item:hover { color: var(--text); background: rgba(255,255,255,.025); }
.session-item.active { color: var(--text); border-color: rgba(119,229,181,.18); background: rgba(119,229,181,.055); }
.session-delete-button { position: absolute; z-index: 1; top: 50%; right: 7px; min-width: 30px; height: 24px; padding: 0 5px; translate: 0 -50%; border: 1px solid transparent; border-radius: 7px; color: #748b83; background: transparent; font-size: 8px; opacity: 0; transition: opacity .15s ease, color .15s ease, border-color .15s ease, background .15s ease; }
.session-entry:hover .session-delete-button, .session-entry:focus-within .session-delete-button, .session-entry.active .session-delete-button { opacity: 1; }
.session-delete-button:hover { color: var(--red); border-color: rgba(255,125,125,.22); background: rgba(255,125,125,.06); }
.session-delete-button:disabled { cursor: not-allowed; color: #52635d; opacity: .45; }
.session-item-heading { min-width: 0; display: flex; align-items: center; gap: 7px; }
.session-item-heading strong { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 570; }
.session-kind { flex: 0 0 auto; padding: 1px 5px; border: 1px solid rgba(112,169,255,.22); border-radius: 999px; color: #88aef0; font-size: 8px; }
.session-entry.managed-coding::before { content: ""; position: absolute; left: calc(7px + var(--session-depth, 0) * 12px); top: 15px; bottom: 15px; width: 1px; background: rgba(112,169,255,.16); }
.session-status { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; color: #718a81; font-size: 8px; white-space: nowrap; }
.session-status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #607970; }
.session-status.queued::before, .session-status.running::before, .session-status.pending::before, .session-status.waiting_authorization::before { background: var(--amber); box-shadow: 0 0 8px rgba(242,200,121,.4); }
.session-status.succeeded::before { background: var(--green); }
.session-status.failed::before { background: var(--red); }
.session-status.recoverable::before { background: var(--blue); }
.session-item-meta { overflow: hidden; color: #526960; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.session-sidebar-note { flex: 0 0 auto; margin: 8px 5px 0; padding: 11px; border: 1px solid rgba(139,188,255,.12); border-radius: 10px; color: #637c73; background: rgba(139,188,255,.025); font-size: 9px; line-height: 1.55; }
.session-sidebar-note span { margin-right: 5px; color: var(--blue); }
.chat-workspace { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.chat-app-header { flex: 0 0 auto; min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 4px; border-bottom: 1px solid rgba(163,200,188,.11); }
.chat-title-group { display: flex; align-items: center; gap: 11px; min-width: 0; }
.conversation-mark { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(119,229,181,.26); border-radius: 50%; color: var(--green); background: linear-gradient(145deg, rgba(119,229,181,.13), rgba(119,229,181,.025)); font: 700 9px/1 monospace; box-shadow: 0 0 28px rgba(119,229,181,.05); }
.conversation-mark.has-image,
.chat-avatar.has-image,
.empty-mark > span.has-image,
.agent-avatar-preview.has-image,
.agent-list-avatar.has-image { overflow: hidden; padding: 0; background: rgba(8,16,14,.9); }
.conversation-mark img,
.chat-avatar img,
.empty-mark img,
.agent-avatar-preview img,
.agent-list-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.chat-app-header h1 { margin: 0; font-size: 14px; font-weight: 620; letter-spacing: -.01em; }
.chat-app-header p { margin: 3px 0 0; color: #6f8980; font-size: 10px; }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }
.route-status { min-width: 0; max-width: 340px; height: 36px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; text-decoration: none; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.route-status:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.025); }
.route-status > span:not(.route-indicator) { font-size: 10px; white-space: nowrap; }
.route-status strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b9d0c8; font: 10px/1 monospace; }
.route-indicator { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(119,229,181,.08); }
.route-indicator.unconfigured { background: var(--amber); box-shadow: 0 0 0 4px rgba(242,200,121,.08); }
.new-chat-button { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(255,255,255,.025); font-size: 11px; transition: border-color .15s ease, background .15s ease; }
.new-chat-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.new-chat-button:disabled { opacity: .45; cursor: default; }
.new-chat-button span:first-child { color: var(--green); font-size: 17px; font-weight: 300; }
.modern-chat-messages { flex: 1 1 auto; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: scroll; overscroll-behavior-y: contain; scroll-behavior: smooth; scrollbar-gutter: stable; scrollbar-width: thin; padding: 34px 8px 178px; border: 0; border-radius: 0; background: transparent; scrollbar-color: rgba(145,170,161,.45) transparent; }
.modern-chat-messages::-webkit-scrollbar { width: 10px; }
.modern-chat-messages::-webkit-scrollbar-track { background: transparent; }
.modern-chat-messages::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: rgba(145,170,161,.42); background-clip: padding-box; }
.modern-chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(145,170,161,.62); background-clip: padding-box; }
.chat-workspace.is-empty .modern-chat-messages { flex: 0 0 auto; overflow: visible; padding: clamp(64px, 12vh, 132px) 8px 26px; }
.modern-chat-messages .chat-empty { width: min(880px, 100%); min-height: 0; margin: 0 auto; display: flex; place-content: initial; flex-direction: column; align-items: center; color: var(--muted); }
.empty-mark { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 16px; border: 1px solid rgba(119,229,181,.25); border-radius: 16px; background: linear-gradient(145deg, rgba(119,229,181,.16), rgba(119,229,181,.025)); box-shadow: 0 14px 50px rgba(34,145,102,.1); }
.empty-mark span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: #9bf1cc; background: rgba(119,229,181,.09); font: 750 9px/1 monospace; }
.empty-mark > span.has-image { width: 100%; height: 100%; border-radius: inherit; }
.chat-empty-kicker { margin: 0 0 10px; color: var(--green); font: 700 9px/1.2 monospace; letter-spacing: .16em; }
.modern-chat-messages .chat-empty > strong { display: block; margin: 0; color: var(--text); font-size: clamp(26px, 3vw, 34px); font-weight: 560; line-height: 1.2; letter-spacing: -.035em; }
.chat-empty-copy { margin: 10px 0 0; color: #809990; font-size: 13px; }
.modern-chat-messages .chat-message { width: min(820px, 100%); max-width: none; display: flex; align-items: flex-start; gap: 13px; margin: 0 auto 22px; padding: 0; border: 0; background: transparent; animation: message-in .18s ease-out; }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }
.modern-chat-messages .chat-message.user { justify-content: flex-end; margin-left: auto; background: transparent; border: 0; }
.modern-chat-messages .chat-message.system { align-items: center; }
.modern-chat-messages .chat-message.system .chat-message-body { padding: 11px 13px; border: 1px solid rgba(255,140,131,.24); border-radius: 13px; background: rgba(255,140,131,.055); }
.modern-chat-messages .chat-message.notice { align-items: center; }
.modern-chat-messages .chat-message.notice .chat-avatar { border-color: rgba(112,169,255,.28); color: #9abcf4; background: rgba(112,169,255,.08); }
.modern-chat-messages .chat-message.notice .chat-message-body { padding: 11px 13px; border: 1px solid rgba(112,169,255,.2); border-radius: 13px; background: rgba(112,169,255,.045); }
.modern-chat-messages .chat-role { display: none; }
.chat-avatar { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid rgba(119,229,181,.24); border-radius: 50%; color: var(--green); background: linear-gradient(145deg, rgba(119,229,181,.12), rgba(15,27,25,.88)); font: 700 9px/1 monospace; }
.modern-chat-messages .chat-message.user .chat-avatar { display: none; }

/* Agent profile settings */
.agent-management-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px); gap: 20px; align-items: start; }
.agent-profile-editor { min-width: 0; }
.agent-profile-list-panel { position: sticky; top: 88px; max-height: calc(100vh - 112px); overflow: auto; }
.agent-identity-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; align-items: start; }
.agent-avatar-editor { display: flex; flex-direction: column; align-items: center; gap: 9px; }
.agent-avatar-editor small { color: var(--muted); text-align: center; line-height: 1.45; }
.agent-avatar-preview { width: 104px; height: 104px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(119,229,181,.3); border-radius: 30px; color: var(--green); background: linear-gradient(145deg, rgba(119,229,181,.16), rgba(8,16,14,.92)); box-shadow: 0 18px 50px rgba(0,0,0,.22); font: 750 20px/1 monospace; }
.agent-avatar-upload { position: relative; overflow: hidden; cursor: pointer; }
.agent-avatar-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.agent-identity-fields { min-width: 0; display: grid; gap: 14px; }
.agent-system-prompt { min-height: 250px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.55; }
.agent-profile-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.agent-capability-summary { margin: 0; color: var(--text); font-size: 13px; line-height: 1.6; }
.agent-capability-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.agent-capability-search { flex: 1 1 200px; min-width: 0; }
.agent-capability-toolbar .button { flex: 0 0 auto; }
.agent-capability-group-heading { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-top: 8px; }
.agent-capability-group-heading h4 { margin: 0; font-size: 14px; }
.agent-capability-group-heading > span { color: var(--muted); font-size: 12px; }
.agent-capability-help { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.agent-capability-help a { color: var(--green); }
.agent-skill-list { display: grid; grid-auto-rows: max-content; gap: 9px; max-height: 440px; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; scrollbar-width: auto; scrollbar-color: var(--muted) transparent; padding-right: 4px; }
.agent-skill-list:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.agent-skill-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.018); cursor: pointer; }
.agent-skill-option:hover { border-color: rgba(119,229,181,.24); background: rgba(119,229,181,.025); }
.agent-skill-option.disabled { opacity: .55; cursor: not-allowed; }
.agent-skill-option input { margin-top: 3px; accent-color: var(--green); }
.agent-skill-option > span { min-width: 0; display: grid; gap: 5px; }
.agent-skill-heading { display: flex; flex-wrap: wrap; gap: 5px 10px; justify-content: space-between; align-items: center; }
.agent-skill-heading strong { min-width: 0; overflow-wrap: anywhere; }
.agent-skill-heading small { flex: 0 0 auto; }
.agent-skill-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); line-height: 1.5; }
.agent-execution-option { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.agent-execution-option > span { min-width: 0; display: grid; gap: 5px; }
.agent-capability-kind { padding-top: 2px; color: var(--muted); font-size: 10px; }
.agent-profile-list { display: grid; gap: 8px; margin-top: 14px; }
.agent-profile-item { width: 100%; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 12px; color: var(--text); text-align: left; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.018); cursor: pointer; }
.agent-profile-item:hover,
.agent-profile-item.selected { border-color: rgba(119,229,181,.3); background: rgba(119,229,181,.045); }
.agent-list-avatar { width: 46px; height: 46px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(119,229,181,.25); border-radius: 14px; color: var(--green); background: rgba(119,229,181,.07); font: 750 11px/1 monospace; }
.agent-list-copy { min-width: 0; display: grid; gap: 4px; }
.agent-list-copy > small,
.agent-list-copy > span { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.agent-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-list-heading small { flex: 0 0 auto; }
.agent-revision-panel { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.agent-revision-panel h3 { margin: 0 0 10px; font-size: 14px; }
#agent-revision-list { display: grid; gap: 7px; }
.agent-revision-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.agent-revision-item > span { min-width: 0; display: grid; gap: 3px; }
.agent-revision-item small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.agent-profile-actions { display: flex; gap: 8px; margin-top: 14px; }
.chat-message-body { min-width: 0; max-width: calc(100% - 45px); padding: 3px 0 0; border: 0; border-radius: 0; background: transparent; }
.modern-chat-messages .chat-message.streaming .chat-message-body { width: calc(100% - 45px); max-width: calc(100% - 45px); flex: 1 1 0; }
.modern-chat-messages .chat-message.user .chat-message-body { max-width: min(680px, 78%); padding: 10px 15px; border: 1px solid rgba(163,200,188,.13); border-radius: 17px 17px 5px 17px; background: rgba(26,43,39,.82); }
.rich-content { white-space: normal; line-height: 1.58; font-size: 14px; }
.modern-chat-messages .rich-content { color: #e6f0ec; font-size: 14.25px; }
.chat-message.streaming .stream-content { color: #a9beb6; }
.rich-content > :first-child { margin-top: 0; }
.rich-content > :last-child { margin-bottom: 0; }
.rich-content h1, .rich-content h2, .rich-content h3, .rich-content h4, .rich-content h5, .rich-content h6 { margin: 16px 0 6px; line-height: 1.32; font-weight: 640; letter-spacing: -.015em; }
.rich-content h1 { max-width: none; font-size: 1.45em; }
.rich-content h2 { font-size: 1.28em; }
.rich-content h3 { font-size: 1.14em; }
.rich-content h4, .rich-content h5, .rich-content h6 { font-size: 1em; }
.rich-content p, .rich-content ul, .rich-content ol, .rich-content blockquote, .rich-content pre, .rich-content table { margin: 7px 0; }
.rich-content ul, .rich-content ol { padding-left: 22px; }
.rich-content li { margin: 3px 0; }
.rich-content li > p { margin: 0; }
.rich-content li > ul, .rich-content li > ol { margin: 4px 0; }
.rich-content blockquote { padding: 2px 0 2px 13px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.rich-content a { color: var(--green); }
.rich-content table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rich-content th, .rich-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.rich-content :not(pre) > code { padding: 2px 5px; border-radius: 5px; color: #b9f5d9; background: rgba(119,229,181,.08); font-size: .9em; }
.rich-content pre, .chat-attachment pre { position: relative; overflow: auto; max-height: 480px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #06100e; }
.rich-content pre code, .chat-attachment pre code { font: 12px/1.62 "SFMono-Regular", Consolas, monospace; }
.copy-code { position: absolute; top: 8px; right: 8px; min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #10201d; font-size: 10px; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #ff9f98; }
.hljs-string, .hljs-attr, .hljs-template-tag { color: #9ce3ba; }
.hljs-number, .hljs-symbol, .hljs-variable { color: #f2c879; }
.hljs-title, .hljs-section, .hljs-function { color: #8bbcff; }
.hljs-comment, .hljs-quote { color: #68827a; font-style: italic; }
.chat-message-footer { min-height: 22px; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.chat-message-footer .chat-meta { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #60776f; font: 9px/1.5 monospace; }
.chat-capability-warning { width: min(820px, 100%); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 11px; align-items: start; margin: -8px auto 28px; padding: 13px 14px; border: 1px solid rgba(242,200,121,.24); border-radius: 13px; color: #d9cda8; background: rgba(242,200,121,.055); }
.chat-capability-warning > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--amber); background: rgba(242,200,121,.1); font-size: 11px; }
.chat-capability-warning strong { display: block; margin-bottom: 5px; color: #f0e7ca; font-size: 11px; }
.chat-capability-warning ul { margin: 0; padding-left: 17px; color: #998e70; font-size: 10px; line-height: 1.55; }
.chat-capability-warning a { align-self: center; color: var(--amber); font-size: 10px; text-decoration: none; white-space: nowrap; }
.chat-capability-warning a:hover { color: #ffe4a8; }
.chat-tool-activity { width: 100%; min-width: 0; max-width: none; min-height: 116px; display: grid; grid-template-rows: 26px 12px 32px; gap: 11px; margin-top: 14px; padding: 15px 17px 14px; border: 1px solid rgba(119,229,181,.22); border-radius: 15px; background: linear-gradient(145deg, rgba(23,43,37,.86), rgba(11,25,21,.92)); box-shadow: inset 0 1px rgba(255,255,255,.03), 0 12px 32px rgba(0,0,0,.12); }
.tool-progress-heading { min-width: 0; min-height: 26px; display: grid; grid-template-columns: minmax(0, 1fr) 118px; align-items: center; gap: 14px; }
.tool-progress-title { overflow: hidden; color: #d7e7e1; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.tool-progress-value { width: 118px; min-width: 118px; overflow: hidden; padding: 6px 9px; border: 1px solid rgba(119,229,181,.18); border-radius: 999px; color: #98edc8; background: rgba(119,229,181,.07); text-align: center; text-overflow: ellipsis; white-space: nowrap; font: 700 10px/1 monospace; font-variant-numeric: tabular-nums; }
.tool-progress-track { position: relative; width: 100%; height: 12px; overflow: hidden; border: 1px solid rgba(163,200,188,.16); border-radius: 999px; background: rgba(2,10,8,.82); box-shadow: inset 0 1px 4px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.012); }
.tool-progress-fill { position: absolute; inset: 2px; overflow: hidden; border-radius: inherit; background: linear-gradient(90deg, #39c98e 0%, #77e5b5 72%, #a4f2d1 100%); box-shadow: 0 0 16px rgba(119,229,181,.3); transform: scaleX(var(--tool-progress-ratio, 0)); transform-origin: left center; transition: transform .32s ease; will-change: transform; }
.tool-progress-track.is-indeterminate .tool-progress-fill { background: linear-gradient(90deg, rgba(88,201,155,.18), rgba(139,225,189,.92), rgba(88,201,155,.18)); background-size: 220% 100%; transform: scaleX(1); animation: tool-progress-flow 1.8s linear infinite; }
.chat-tool-activity > .tool-progress-message { height: 32px; display: -webkit-box; overflow: hidden; margin: 0; color: #829b92; font-size: 10px; line-height: 16px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
@keyframes tool-progress-flow { from { background-position: 100% 0; } to { background-position: -120% 0; } }
.chat-artifact-gallery { display: grid; gap: 12px; margin-top: 14px; }
.chat-video-artifact { min-width: 0; overflow: hidden; border: 1px solid rgba(139,188,255,.22); border-radius: 13px; background: #050c0b; box-shadow: 0 16px 44px rgba(0,0,0,.16); }
.video-artifact-heading { min-height: 47px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: rgba(139,188,255,.035); }
.video-artifact-heading strong, .video-artifact-heading small { display: block; }
.video-artifact-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.video-artifact-heading small { margin-top: 4px; color: #6f8880; font-size: 9px; }
.video-artifact-badge { flex: 0 0 auto; padding: 4px 6px; border-radius: 6px; color: var(--blue); background: rgba(139,188,255,.08); font: 700 8px/1 monospace; }
.chat-video-artifact video { display: block; width: 100%; max-height: 520px; aspect-ratio: 16 / 9; object-fit: contain; background: #020504; }
.chat-audio-artifact audio { display: block; width: calc(100% - 24px); height: 42px; margin: 14px 12px; }
.chat-image-artifact img { display: block; width: 100%; max-height: 620px; object-fit: contain; background: #020504; }
.chat-html-preview { display: block; width: 100%; height: clamp(360px, 72vh, 820px); border: 0; border-top: 1px solid var(--border); background: white; }
.chat-file-artifact .video-artifact-footer { gap: 16px; flex-wrap: wrap; }
.video-artifact-footer { min-height: 42px; display: flex; align-items: center; flex-wrap: wrap; gap: 9px 14px; padding: 9px 12px; border-top: 1px solid var(--line); }
.video-download-link { color: var(--green); font-size: 10px; font-weight: 650; text-decoration: none; }
.video-download-link::before { content: "↓"; margin-right: 5px; }
.video-artifact-expiry, .video-playback-error { color: #687f77; font-size: 8px; }
.video-playback-error { flex-basis: 100%; color: var(--amber); }
.response-actions { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.response-action { display: grid; place-items: center; width: 32px; height: 32px; padding: 7px; border: 0; border-radius: 8px; color: var(--portal-muted, var(--muted)); background: transparent; cursor: pointer; transition: color .15s, background .15s; }
.response-action svg { width: 18px; height: 18px; }
.response-action:hover:not(:disabled), .response-action[aria-pressed="true"] { color: var(--portal-text, var(--text)); background: var(--portal-hover, rgba(145,170,161,.12)); }
.response-action[aria-pressed="true"] svg { fill: currentColor; fill-opacity: .14; }
.response-action:disabled { opacity: .35; cursor: default; }
.response-action:focus-visible, .response-feedback-popover button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.response-copy-buffer { position: fixed; top: 0; left: -9999px; }
.response-feedback-popover { position: fixed; z-index: 220; width: min(352px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px; border: 1px solid var(--portal-line, var(--line)); border-radius: 16px; color: var(--portal-text, var(--text)); background: var(--portal-panel, #12231e); box-shadow: 0 12px 48px rgba(0,0,0,.24); }
.response-feedback-popover > strong { font-size: 14px; }
.response-feedback-popover > p { margin: 7px 0 15px; color: var(--portal-muted, var(--muted)); font-size: 12px; line-height: 1.5; }
.response-feedback-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.response-feedback-choice { padding: 8px 11px; border: 1px solid var(--portal-line, var(--line)); border-radius: 8px; color: inherit; background: transparent; font-size: 12px; cursor: pointer; }
.response-feedback-choice:hover, .response-feedback-choice.selected { background: var(--portal-hover, rgba(145,170,161,.12)); border-color: var(--portal-muted, var(--muted)); }
.response-feedback-editor { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 13px; }
.response-feedback-editor textarea { grid-column: 1 / -1; width: 100%; min-height: 90px; max-height: 160px; resize: vertical; padding: 10px; border: 1px solid var(--portal-line, var(--line)); border-radius: 9px; color: inherit; background: var(--portal-bg, #091711); font: inherit; font-size: 12px; line-height: 1.6; }
.response-feedback-counter { align-self: center; color: var(--portal-muted, var(--muted)); font-size: 11px; }
.response-feedback-submit { padding: 8px 13px; border: 0; border-radius: 8px; color: var(--portal-bg, #07100e); background: var(--portal-text, var(--green)); font-size: 12px; cursor: pointer; }
.response-feedback-submit:disabled { opacity: .4; cursor: default; }
.response-feedback-clear { margin-top: 13px; padding: 3px 0; border: 0; color: var(--portal-muted, var(--muted)); background: none; font-size: 11px; cursor: pointer; }
@media (max-width: 720px) {
  .chat-message-footer { align-items: flex-start; flex-wrap: wrap; gap: 4px; }
  .chat-message-footer .chat-meta { flex-basis: 100%; }
  .response-action { width: 36px; height: 36px; }
}
.chat-composer-wrap { flex: 0 0 auto; position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 6px 14px; background: linear-gradient(180deg, rgba(7,16,14,0), #07100e 34%); }
.scroll-latest { position: absolute; right: 22px; bottom: 142px; z-index: 12; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid rgba(163,200,188,.22); border-radius: 999px; color: #b9d0c8; background: rgba(15,28,25,.94); box-shadow: 0 8px 28px rgba(0,0,0,.24); font-size: 10px; }
.scroll-latest:hover { color: var(--text); border-color: rgba(119,229,181,.4); }
.chat-workspace.is-empty .chat-composer-wrap { position: relative; left: auto; right: auto; bottom: auto; padding: 0 6px; background: transparent; }
.modern-chat-form { width: min(820px, 100%); margin: 0 auto; padding: 10px 10px 9px; border: 1px solid rgba(163,200,188,.27); border-radius: 19px; background: rgba(15,28,25,.97); box-shadow: 0 18px 60px rgba(0,0,0,.27), inset 0 1px rgba(255,255,255,.018); transition: border-color .16s ease, box-shadow .16s ease; }
.modern-chat-form:focus-within { border-color: rgba(119,229,181,.46); box-shadow: 0 20px 68px rgba(0,0,0,.32), 0 0 0 3px rgba(119,229,181,.035); }
.modern-chat-form textarea { width: 100%; min-height: 52px; max-height: 180px; padding: 10px 11px 8px; border: 0; color: var(--text); background: transparent; box-shadow: none; resize: none; font-size: 14px; line-height: 1.55; }
.modern-chat-form textarea::placeholder { color: #627970; }
.composer-actions { display: flex; align-items: center; gap: 8px; padding: 5px 2px 0; }
.composer-primary-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.composer-primary-actions :is(.chat-send, .chat-stop) { margin-left: 0; }
.attach-button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 9px; border: 1px solid transparent; border-radius: 9px; color: #8ca49b; cursor: pointer; font-size: 10px; transition: color .15s ease, border-color .15s ease, background .15s ease; }
.attach-button:hover { color: var(--text); border-color: var(--line); background: rgba(255,255,255,.025); }
.attach-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attach-icon { color: var(--green); font-size: 17px; font-weight: 300; line-height: 1; }
.composer-hint { margin-left: auto; color: #566e66; font-size: 9px; }
.chat-send { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; margin-left: auto; padding: 0; border: 0; border-radius: 50%; color: #082019; background: var(--green); font-size: 19px; font-weight: 650; line-height: 1; transition: transform .14s ease, background .14s ease, opacity .14s ease; }
.chat-send:hover:not(:disabled) { transform: translateY(-1px); background: #91edc6; }
.chat-send:disabled { color: #657a72; background: #263a35; cursor: default; }
.chat-send.is-loading { color: var(--green); background: rgba(119,229,181,.1); }
.chat-stop { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 0 10px; border: 1px solid rgba(255,140,131,.24); border-radius: 9px; color: #ffc4be; background: rgba(255,140,131,.07); font-size: 10px; }
.chat-stop:hover:not(:disabled) { border-color: rgba(255,140,131,.45); background: rgba(255,140,131,.12); }
.chat-stop:disabled { opacity: .5; cursor: default; }
.chat-stop span:first-child { font-size: 8px; }
.chat-recovery { width: min(820px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 auto 28px; padding: 16px 17px; border: 1px solid rgba(139,188,255,.24); border-radius: 14px; background: rgba(139,188,255,.055); }
.chat-recovery strong, .chat-recovery p, .chat-recovery small { display: block; }
.chat-recovery strong { margin-bottom: 5px; font-size: 12px; }
.chat-recovery p { margin: 0; color: #94aaa2; font-size: 11px; line-height: 1.5; }
.chat-recovery small { margin-top: 6px; color: #5f7870; font-size: 9px; line-height: 1.45; }
.composer-disclaimer { width: min(820px, 100%); margin: 8px auto 0; color: #4f655e; text-align: center; font-size: 8px; letter-spacing: .01em; }
.chat-workspace.is-empty .composer-disclaimer { margin-top: 10px; }
.pending-attachments { width: min(820px, 100%); display: flex; gap: 8px; margin: 0 auto 8px; overflow-x: auto; padding: 3px 1px; }
.pending-attachment { flex: 0 0 auto; max-width: 250px; display: flex; align-items: center; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); }
.pending-attachment img, .pending-kind { width: 36px; height: 36px; flex: 0 0 auto; border-radius: 7px; object-fit: cover; }
.pending-kind { display: grid; place-items: center; color: var(--green); background: rgba(119,229,181,.08); font: 700 8px/1 monospace; }
.pending-name { min-width: 0; }
.pending-name strong, .pending-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-name strong { font-size: 10px; }
.pending-name small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.pending-remove { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; color: var(--muted); background: transparent; }
.pending-remove:hover { color: var(--red); background: rgba(255,140,131,.08); }
.chat-attachment-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.chat-attachment { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #07100e; }
.chat-attachment.image, .chat-attachment.audio, .chat-attachment.video, .chat-attachment.html { grid-column: 1 / -1; }
.attachment-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--line); }
.attachment-heading strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-heading span { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.chat-attachment img, .chat-attachment video { display: block; width: 100%; max-height: 460px; object-fit: contain; background: #030807; }
.chat-attachment audio { display: block; width: calc(100% - 22px); margin: 12px 11px; }
.chat-attachment iframe { display: block; width: 100%; height: 320px; border: 0; background: white; }
.chat-attachment pre { margin: 0; border: 0; border-radius: 0; }
.attachment-boundary { display: block; margin: 0; padding: 9px 11px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.drop-overlay { position: absolute; inset: 10px 0; z-index: 30; display: grid; place-items: center; border: 1px dashed rgba(119,229,181,.55); border-radius: 18px; color: var(--green); background: rgba(7,20,17,.96); font-size: 16px; font-weight: 600; pointer-events: none; backdrop-filter: blur(8px); }

.chat-pet {
  --pet-accent: rgba(119, 229, 181, .8);
  position: absolute;
  z-index: 16;
  right: 14px;
  bottom: 150px;
  width: 124px;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: inherit;
  background: transparent;
  cursor: grab;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}
.chat-pet::before {
  content: "";
  position: absolute;
  inset: 13px 3px 6px;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--pet-accent) 0%, transparent 72%);
  opacity: .13;
  filter: blur(12px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  transform: scale(.86);
}
.chat-pet:is([data-state="generating"], [data-state="running"])::before {
  opacity: .3;
  transform: scale(1);
}
.chat-pet:is([data-state="review"], [data-state="failed"])::before { opacity: .22; }
.chat-pet:focus-visible { outline: 2px solid rgba(119, 229, 181, .7); outline-offset: 3px; }
.chat-workspace.is-empty .chat-pet { bottom: 18px; }
.chat-pet.is-dragging { z-index: 19; }
.chat-pet.is-dragging { cursor: grabbing; }
.chat-pet-sprite {
  width: 112px;
  height: calc(112px * 208 / 192);
  background-repeat: no-repeat;
  background-size: 800% 1000%;
  background-position: calc(var(--pet-frame, 0) * 100% / 7) calc(var(--pet-row, 0) * 100% / 9);
  image-rendering: auto;
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, .28));
  pointer-events: none;
}
.chat-pet-status {
  position: absolute;
  right: 0;
  bottom: calc(100% + 2px);
  box-sizing: border-box;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(163, 200, 188, .22);
  border-radius: 12px;
  color: #c5ddd4;
  background: rgba(10, 20, 18, .88);
  font: 500 12px/1.5 system-ui, sans-serif;
  text-align: center;
  overflow-wrap: anywhere;
  white-space: normal;
  box-shadow: 0 5px 20px rgba(0, 0, 0, .12);
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.chat-pet-status[hidden] { display: none; }
.chat-pet-status::after { content: ""; position: absolute; width: 7px; height: 7px; left: calc(50% - 4px); bottom: -5px; border-right: 1px solid; border-bottom: 1px solid; border-color: inherit; background: inherit; transform: rotate(45deg); }
.chat-pet[data-bubble-side="below"] .chat-pet-status { bottom: auto; top: calc(100% + 2px); }
.chat-pet[data-bubble-side="below"] .chat-pet-status::after { bottom: auto; top: -5px; transform: rotate(225deg); }
.chat-pet[data-state="generating"] .chat-pet-status { color: #9ee7ff; border-color: rgba(126, 220, 255, .34); }
.chat-pet[data-state="running"] .chat-pet-status { color: #9bf1cc; border-color: rgba(119, 229, 181, .28); }
.chat-pet[data-state="waiting"] .chat-pet-status { color: #f2c879; border-color: rgba(242, 200, 121, .32); }
.chat-pet[data-state="review"] .chat-pet-status { color: #9abcf4; border-color: rgba(112, 169, 255, .3); }
.chat-pet[data-state="failed"] .chat-pet-status { color: #ffb1aa; border-color: rgba(255, 140, 131, .32); }
@media (prefers-reduced-motion: reduce) {
  .chat-pet-sprite { transition: none; }
}

.audit-panel { margin-top: 18px; }
.audit-list { display: grid; }
.audit-item { display: grid; grid-template-columns: 110px 150px 1fr auto; gap: 14px; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); font-size: 12px; }
.audit-item:first-child { border-top: 0; }
.audit-item time, .audit-item span { color: var(--muted); }
.audit-item code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9d9d3; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 48px)); padding: 14px 17px; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text); background: #183029; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .18s ease; z-index: 50; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255,140,131,.5); background: #3a1c1a; }

.auth-account { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.auth-account .auth-role { padding: 7px 10px; border: 1px solid rgba(119,229,181,.25); border-radius: 999px; color: var(--green); font-size: 11px; }
.auth-account a, .auth-account button { border: 0; padding: 5px; color: var(--muted); background: transparent; text-decoration: none; font-size: 11px; }
.auth-account a:hover, .auth-account button:hover { color: var(--text); }
.admin-hidden { display: none !important; }
.readonly-banner { margin-bottom: 20px; padding: 12px 15px; border: 1px solid rgba(139,188,255,.28); border-radius: 12px; color: #cfe1ff; background: rgba(65,107,166,.13); font-size: 13px; }

.login-page { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 100svh; padding: 36px; overflow-x: hidden; background: radial-gradient(circle at 16% 48%, rgba(21,100,81,.35), transparent 35%), radial-gradient(circle at 85% -12%, rgba(52,100,129,.24), transparent 37%), #07100f; }
.login-page::before, .login-page::after, .portal-access-page::before, .portal-access-page::after { content: ""; position: fixed; pointer-events: none; z-index: 0; }
.login-page::before { inset: -25%; background: radial-gradient(circle, rgba(122,231,188,.46) 1px, transparent 2px) 0 0 / 38px 38px; mask-image: radial-gradient(ellipse at 30% 57%, #000 0, rgba(0,0,0,.6) 34%, transparent 64%); transform: perspective(900px) rotateX(48deg) translateY(0); animation: access-control-grid 25s linear infinite; }
.login-page::after { inset: -8%; opacity: .9; background-image: radial-gradient(circle at 8% 18%, #95e7c3 0 1.5px, transparent 3px), radial-gradient(circle at 18% 63%, #8bddc5 0 1px, transparent 3px), radial-gradient(circle at 27% 31%, #a1efd4 0 1.5px, transparent 3px), radial-gradient(circle at 36% 79%, #74bbd5 0 1px, transparent 3px), radial-gradient(circle at 51% 12%, #9bead5 0 1px, transparent 3px), radial-gradient(circle at 63% 53%, #7bcabf 0 1.5px, transparent 3px), radial-gradient(circle at 72% 27%, #b0eee1 0 1px, transparent 3px), radial-gradient(circle at 83% 72%, #8adcd0 0 1.5px, transparent 3px), radial-gradient(circle at 92% 38%, #a8e7d9 0 1px, transparent 3px); animation: access-particles-drift 18s ease-in-out infinite alternate; }
.login-shell { position: relative; z-index: 1; width: min(100%, 1040px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: center; gap: clamp(40px, 7vw, 110px); }
.login-intro { max-width: 540px; padding: 32px 0; }
.login-intro h2 { margin: 26px 0 21px; color: #e9fff4; font-size: clamp(39px, 4.6vw, 64px); font-weight: 580; line-height: 1.15; letter-spacing: -.055em; }
.login-intro h2 em { color: #84e8bb; font-style: normal; }
.login-intro > p:not(.access-intro-kicker) { max-width: 420px; color: #a2bfb5; font-size: 15px; line-height: 1.8; }
.login-intro-line { display: flex; gap: 21px; margin-top: 54px; padding-top: 18px; border-top: 1px solid rgba(133,226,184,.2); color: #78ae9b; font: 700 10px/1.4 monospace; letter-spacing: .11em; }
.login-card { padding: 38px; border: 1px solid rgba(157,231,199,.24); border-radius: 26px; background: linear-gradient(145deg, rgba(23,43,38,.88), rgba(8,19,17,.91)); box-shadow: 0 32px 110px rgba(0,0,0,.52), inset 0 1px rgba(255,255,255,.07); backdrop-filter: blur(24px); }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card h1 { margin-bottom: 12px; font-size: clamp(32px, 3.4vw, 40px); }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.login-card form { margin-top: 28px; }
.login-card form .button { width: 100%; min-height: 46px; }
.login-error { margin: 15px 0 0; padding: 10px 12px; border: 1px solid rgba(255,140,131,.35); border-radius: 10px; color: #ffd3cf !important; background: rgba(255,140,131,.09); font-size: 13px; }
.login-security-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; }

.security-shell { max-width: 1100px; }
.security-shell h1 { font-size: clamp(38px, 5vw, 58px); }
.security-grid { margin-top: 28px; }
.password-form { padding: 26px; }
.password-form-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.password-form-heading h2 { margin: 0; }
.password-form-heading p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: right; }
.password-form-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 18px; margin-top: 22px; }
.password-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 5px; }
.password-form-actions span { color: var(--muted); font-size: 11px; }
.scheduler-panel { margin-top: 18px; padding: 28px; }
.scheduler-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.scheduler-heading h2 { margin: 2px 0 5px; }
.scheduler-heading p:last-child { max-width: 690px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.scheduler-state { flex: 0 0 auto; margin-top: 5px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 11px; font-weight: 700; }
.scheduler-state.is-ready { border-color: rgba(119,229,181,.28); color: var(--accent); background: rgba(119,229,181,.07); }
.scheduler-state.is-warning { border-color: rgba(255,191,105,.3); color: #ffd19a; background: rgba(255,191,105,.07); }
.scheduler-form { margin-top: 23px; }
.scheduler-limit-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.scheduler-limit-card { display: grid; grid-template-columns: minmax(0,1fr) 176px; align-items: center; gap: 10px 22px; padding: 22px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface-strong); }
.scheduler-limit-card > span { color: var(--text); font-size: 16px; font-weight: 650; line-height: 1.5; }
.scheduler-limit-card input { grid-column: 2; grid-row: 1 / span 2; min-width: 0; min-height: 66px; padding: 12px 10px; border: 2px solid var(--muted); border-radius: 12px; color: var(--text); text-align: center; font-size: 28px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.scheduler-form .scheduler-limit-card small { color: var(--muted); font-size: 13px; line-height: 1.65; }
@media (max-width: 560px) {
  .scheduler-limit-card { grid-template-columns: minmax(0,1fr); gap: 12px; padding: 18px; }
  .scheduler-limit-card input { grid-column: 1; grid-row: auto; width: min(176px, 100%); }
}
.scheduler-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 10px; padding-top: 22px; border-top: 1px solid var(--line); }
.scheduler-section-heading h3 { margin: 0 0 5px; font-size: 15px; }
.scheduler-section-heading p { max-width: 700px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.scheduler-section-heading .button.compact { min-height: 34px; padding: 7px 12px; }
.resource-pool-list, .mcp-resource-list { display: grid; gap: 9px; }
.resource-pool-row { display: grid; grid-template-columns: minmax(150px,.8fr) minmax(180px,1.25fr) 110px auto; align-items: end; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.016); }
.resource-pool-row label { gap: 6px; }
.resource-pool-row label span { color: var(--muted); font-size: 10px; }
.resource-pool-remove { min-height: 39px; padding: 0 12px; border: 1px solid rgba(255,140,131,.25); border-radius: 9px; color: #ffb6af; background: rgba(255,140,131,.06); cursor: pointer; }
.resource-pool-remove:hover { border-color: rgba(255,140,131,.48); background: rgba(255,140,131,.1); }
.mcp-assignment-heading { margin-top: 6px; }
.mcp-resource-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(220px,330px); align-items: center; gap: 18px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.016); }
.mcp-resource-identity { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.mcp-resource-identity strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mcp-resource-identity small { color: var(--muted); font-size: 10px; }
.scheduler-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.scheduler-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 8px; }
.scheduler-updated { color: var(--muted); font-size: 11px; }
.registration-email-panel { margin-top: 18px; padding: 28px; }
.registration-email-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.registration-email-heading h2 { margin: 2px 0 5px; }
.registration-email-heading p:last-child { max-width: 650px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.registration-mailer-status { flex: 0 0 auto; margin-top: 5px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.025); font-size: 11px; font-weight: 700; }
.registration-mailer-status.is-ready { border-color: rgba(119,229,181,.28); color: var(--accent); background: rgba(119,229,181,.07); }
.registration-mailer-status.is-warning { border-color: rgba(255,191,105,.3); color: #ffd19a; background: rgba(255,191,105,.07); }
.registration-email-form { margin-top: 23px; }
.registration-email-form textarea { min-height: 188px; }
.registration-template-help { display: flex; align-items: center; gap: 12px; margin-top: -4px; color: var(--muted); font-size: 11px; }
.registration-template-placeholders { display: flex; flex-wrap: wrap; gap: 7px; }
.registration-template-token { padding: 5px 9px; border: 1px solid rgba(119,229,181,.2); border-radius: 999px; color: #bdebd7; background: rgba(119,229,181,.055); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 10px; cursor: pointer; }
.registration-template-token:hover { border-color: rgba(119,229,181,.45); background: rgba(119,229,181,.1); }
.registration-template-note { margin: -2px 0 0; color: var(--muted); font-size: 11px; }
.registration-template-note code { color: #bdebd7; }
.registration-email-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.registration-email-updated { color: var(--muted); font-size: 11px; }

@media (max-width: 1040px) {
  .trace-workspace { grid-template-columns: 270px minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .workspace-grid, .onboarding-grid, .model-config-grid, .settings-layout, .model-management-grid { grid-template-columns: 1fr; }
  .services-page .workspace-grid { grid-template-columns: 1fr; }
  .services-page .inventory-panel { position: static; }
  .services-page .metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-guide { grid-template-columns: 1fr; }
  .import-grid { grid-template-columns: 1fr; }
  .tool-upload-panel { grid-column: auto; }
  .detail-panel { min-height: auto; }
  .empty-state { min-height: 300px; }
  .mcp-json-form { grid-template-columns: 1fr; }
  .mcp-json-guide .import-primary-action { margin-top: 2px; }
}

@media (max-width: 900px) {
  .agent-management-grid { grid-template-columns: 1fr; }
  .agent-profile-list-panel { position: static; max-height: none; }
  .auth-account .auth-role, .auth-account a { display: none; }
  .topbar { gap: 12px; }
}

@media (max-width: 1180px) {
  body.mobile-menu-open { overflow: hidden; }
  body.mobile-menu-open .topbar { z-index: 103; }
  .topbar { height: 64px; padding: 0 16px; gap: 10px; }
  .topbar .brand { min-width: 0; margin-right: auto; }
  .topbar .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
  .topbar .service-state, .topbar .auth-account { display: none; }
  .mobile-nav-toggle { width: 42px; height: 42px; flex: 0 0 42px; display: grid; align-content: center; justify-items: center; gap: 5px; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; color: var(--text); background: rgba(255,255,255,.035); box-shadow: 0 10px 28px rgba(0,0,0,.18); }
  .mobile-nav-toggle span { width: 17px; height: 1.5px; border-radius: 999px; background: currentColor; transition: transform .18s ease, opacity .18s ease; }
  .mobile-nav-toggle:hover { border-color: rgba(119,229,181,.46); background: rgba(119,229,181,.08); }
  .mobile-menu-open .mobile-nav-toggle span:first-child { transform: translateY(6.5px) rotate(45deg); }
  .mobile-menu-open .mobile-nav-toggle span:nth-child(2) { opacity: 0; }
  .mobile-menu-open .mobile-nav-toggle span:last-child { transform: translateY(-6.5px) rotate(-45deg); }
  .topbar .main-nav { position: fixed; inset: 0 0 0 auto; z-index: 102; width: min(340px, calc(100vw - 36px)); height: 100dvh; display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0; padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); border: 0; border-left: 1px solid rgba(163,200,188,.19); border-radius: 22px 0 0 22px; background: linear-gradient(165deg, #142622 0%, #0a1412 58%, #08100f 100%); box-shadow: -28px 0 80px rgba(0,0,0,.5); visibility: hidden; transform: translateX(104%); transition: transform .22s ease, visibility .22s; overflow-y: auto; overscroll-behavior: contain; }
  .mobile-menu-open .topbar .main-nav { visibility: visible; transform: translateX(0); }
  .topbar .main-nav > a { position: relative; min-height: 48px; display: flex; align-items: center; flex: 0 0 auto; padding: 0 14px; border: 1px solid transparent; border-radius: 12px; color: #9bb1aa; font-size: 14px; font-weight: 560; }
  .topbar .main-nav > a { justify-content: flex-start; gap: 12px; }
  .topbar .main-nav > a .main-nav-icon, .topbar .main-nav > a .main-nav-icon svg { width: 19px; height: 19px; }
  .topbar .main-nav > a::after { content: ""; position: absolute; right: 15px; width: 6px; height: 6px; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); opacity: .45; }
  .topbar .main-nav > a:hover { border-color: var(--line); background: rgba(255,255,255,.035); }
  .topbar .main-nav > a.active { border-color: rgba(119,229,181,.22); color: #dff8ec; background: linear-gradient(90deg, rgba(119,229,181,.13), rgba(119,229,181,.035)); }
  .topbar .main-nav > a.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 22px; border-radius: 0 4px 4px 0; background: var(--green); box-shadow: 0 0 14px rgba(119,229,181,.5); }
  .mobile-nav-header { min-height: 58px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 10px; padding: 4px 3px 14px 6px; border-bottom: 1px solid var(--line); }
  .mobile-nav-header strong, .mobile-nav-header small { display: block; }
  .mobile-nav-header strong { font-size: 16px; font-weight: 650; }
  .mobile-nav-header small { margin-top: 5px; color: var(--green); font: 700 9px/1 monospace; letter-spacing: .14em; text-transform: uppercase; }
  .mobile-nav-close { position: relative; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.025); }
  .mobile-nav-close::before, .mobile-nav-close::after { content: ""; position: absolute; top: 18px; left: 10px; width: 16px; height: 1.5px; border-radius: 999px; background: currentColor; }
  .mobile-nav-close::before { transform: rotate(45deg); }
  .mobile-nav-close::after { transform: rotate(-45deg); }
  .mobile-nav-close:hover { color: var(--text); border-color: var(--line-strong); }
  .mobile-nav-account { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
  .mobile-nav-account:empty { display: none; }
  .mobile-nav-identity { grid-column: 1 / -1; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid rgba(119,229,181,.13); border-radius: 12px; background: rgba(119,229,181,.045); }
  .mobile-nav-identity .status-dot { flex: 0 0 8px; }
  .mobile-nav-identity small, .mobile-nav-identity strong { display: block; }
  .mobile-nav-identity small { color: #70877f; font-size: 9px; }
  .mobile-nav-identity strong { margin-top: 3px; color: #cce9dc; font-size: 12px; font-weight: 620; }
  .mobile-nav-account > a, .mobile-nav-account > button { min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); text-align: center; text-decoration: none; font-size: 11px; }
  .mobile-nav-account > a { display: grid; place-items: center; }
  .mobile-nav-account > button:hover, .mobile-nav-account > a:hover { color: var(--text); border-color: var(--line-strong); }
  .mobile-nav-scrim { position: fixed; inset: 0; z-index: 101; width: 100%; height: 100%; display: block; padding: 0; border: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s; }
  .mobile-menu-open .mobile-nav-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
}

@media (max-width: 640px) {
  .agent-identity-row { grid-template-columns: 1fr; }
  .agent-avatar-editor { align-items: flex-start; }
  .password-form-heading, .password-form-actions { align-items: stretch; flex-direction: column; }
  .password-form-heading p { text-align: left; }
  .password-form-fields { grid-template-columns: 1fr; }
  .password-form-actions .button { width: 100%; }
  .scheduler-heading, .scheduler-actions, .registration-email-heading, .registration-email-actions, .registration-template-help { align-items: stretch; flex-direction: column; }
  .scheduler-limit-grid { grid-template-columns: 1fr; }
  .resource-pool-row { grid-template-columns: 1fr; }
  .mcp-resource-row { grid-template-columns: 1fr; }
  .scheduler-state { align-self: flex-start; }
  .scheduler-actions .button { width: 100%; }
  .registration-mailer-status { align-self: flex-start; }
  .registration-email-actions .button { width: 100%; }
}

@media (max-width: 720px) {
  /* Contain the closed off-canvas menu without disabling flow/table scrolling. */
  html:has(> .trace-page), .trace-page { overflow-x: clip; }
  .trace-page .topbar { padding: 0 14px; gap: 10px; }
  .trace-page .brand small, .trace-page .service-state { display: none; }
  .trace-page-shell { width: min(100% - 20px, 1560px); padding-top: 23px; }
  .trace-heading { align-items: stretch; flex-direction: column; gap: 17px; }
  .trace-heading-actions { justify-content: space-between; flex-wrap: wrap; }
  .trace-workspace { grid-template-columns: 1fr; }
  .trace-run-panel { position: static; max-height: none; }
  .trace-run-list { max-height: min(40dvh, 310px); }
  .trace-conversation-panel { scroll-margin-top: 78px; }
  .trace-flow-panel, .trace-usage-panel, .trace-timeline-panel { scroll-margin-top: 78px; }
  .trace-run-prompt { display: -webkit-box; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .trace-overview-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .trace-title-row { align-items: flex-start; flex-direction: column; }
  .trace-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .trace-metrics > div:nth-child(odd) { border-left: 0; }
  .trace-metrics > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .trace-usage-row { min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .trace-usage-copy, .trace-usage-bar { grid-column: 1 / -1; }
  .trace-usage-copy strong, .trace-usage-copy small { white-space: normal; overflow-wrap: anywhere; }
  .trace-usage-value strong { overflow-wrap: anywhere; }
  .trace-flow-legend { display: none; }
  .trace-flow-row { grid-template-columns: 34px minmax(0,1fr); }
  .trace-flow-track { flex-direction: column; padding: 10px; }
  .trace-flow-node { flex: 0 0 auto; min-height: 62px; }
  .trace-flow-copy strong, .trace-flow-copy em { white-space: normal; overflow-wrap: anywhere; }
  .trace-flow-edge { width: 100%; height: 24px; flex: 0 0 24px; }
  .trace-flow-edge > span { width: 1px; height: 100%; background: linear-gradient(180deg, rgba(119,229,181,.16), rgba(119,229,181,.6)); }
  .trace-flow-edge > span::after { top: auto; right: auto; bottom: 3px; left: 50%; transform: translateX(-50%) rotate(135deg); }
  .trace-flow-edge small { display: none; }
  .trace-facts { grid-template-columns: 1fr; }
  .trace-facts > div, .trace-facts > div:nth-child(-n+2) { border-top: 1px solid var(--line); border-left: 0; }
  .trace-facts > div:first-child { border-top: 0; }
  .trace-detail-drawer { inset: 8px 0 0; width: 100%; max-width: none; border-top: 1px solid rgba(163,200,188,.24); border-left: 0; border-radius: 20px 20px 0 0; transform: translateY(102%); }
  .trace-detail-drawer.open { transform: translateY(0); }
  .trace-drawer-header { padding: 18px 18px 15px; }
  .trace-drawer-toolbar { padding: 7px 18px; }
  .trace-detail-tabs { padding: 7px 18px; }
  .trace-drawer-body { padding: 18px 18px max(28px, env(safe-area-inset-bottom)); }
  .services-page .topbar { padding: 0 14px; gap: 10px; }
  .services-page .brand small, .services-page .service-state, .services-page .local-badge { display: none; }
  .services-page-shell { width: min(100% - 24px, 1360px); padding-top: 26px; }
  .services-overview { align-items: flex-start; gap: 18px; margin-bottom: 20px; }
  .services-heading h1 { font-size: 38px; }
  .services-heading > p:last-child { max-width: 520px; font-size: 13px; }
  .add-capability-button { min-height: 40px; padding: 0 13px; }
  .service-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .service-summary article { min-height: 68px; padding: 12px 16px; }
  .services-page .capability-list { max-height: 430px; }
  .services-page .detail-panel { min-height: 0; }
  .services-page .audit-item { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .audit-page .topbar { padding: 0 14px; gap: 10px; }
  .audit-page .brand small, .audit-page .service-state, .audit-page .local-badge { display: none; }
  .audit-page-shell { width: min(100% - 24px, 1080px); padding-top: 28px; }
  .audit-page-heading { align-items: flex-start; gap: 18px; }
  .audit-page-heading h1 { font-size: 38px; }
  .model-page-heading { align-items: stretch; flex-direction: column; }
  .model-page-heading .phase-card { min-width: 0; }
  .chat-page .topbar { padding: 0 14px; gap: 10px; }
  .chat-page .brand small, .chat-page .service-state, .chat-page .local-badge { display: none; }
  .chat-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0; padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .session-sidebar { position: fixed; inset: 64px auto 0 0; z-index: 81; width: min(320px, calc(100vw - 44px)); height: auto; min-height: 0; padding: 18px 13px max(16px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left)); border-right: 1px solid rgba(163,200,188,.2); border-bottom: 0; color: var(--text); background: linear-gradient(160deg, #12231f 0%, #091310 72%); box-shadow: 24px 0 70px rgba(0,0,0,.44); visibility: hidden; transform: translateX(-104%); transition: transform .22s ease, visibility .22s; }
  .chat-session-drawer-open .session-sidebar { visibility: visible; transform: translateX(0); }
  .session-sidebar-header { width: auto; padding: 0 5px 16px; border-bottom: 1px solid var(--line); }
  .session-sidebar-header span { display: block; }
  .session-sidebar-header strong { font-size: 14px; }
  .session-new-button { width: 36px; height: 36px; border-radius: 11px; }
  .chat-history-close { position: relative; width: 36px; height: 36px; flex: 0 0 36px; display: block; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.025); }
  .chat-history-close::before, .chat-history-close::after { content: ""; position: absolute; top: 17px; left: 9px; width: 16px; height: 1.5px; border-radius: 999px; background: currentColor; }
  .chat-history-close::before { transform: rotate(45deg); }
  .chat-history-close::after { transform: rotate(-45deg); }
  .session-list { display: grid; gap: 6px; overflow-x: hidden; overflow-y: auto; padding: 12px 3px 12px 0; }
  .session-list-empty { padding: 20px 8px; white-space: normal; }
  .session-entry { width: auto; flex: initial; }
  .session-item { gap: 7px; padding: 11px 44px 11px calc(10px + var(--session-depth, 0) * 12px); }
  .session-delete-button { right: 7px; opacity: 1; }
  .session-item-meta { display: block; }
  .session-sidebar-note { display: block; }
  .chat-session-scrim { position: fixed; inset: 64px 0 0; z-index: 80; width: 100%; height: auto; display: block; padding: 0; border: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s ease, visibility .22s; }
  .chat-session-drawer-open .chat-session-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .chat-workspace { height: 100%; min-height: 0; }
  .chat-app-header { min-height: 58px; gap: 10px; padding: 7px 2px; }
  .chat-title-group { gap: 8px; }
  .chat-history-toggle { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: #91aaa1; background: rgba(255,255,255,.025); }
  .chat-history-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
  .chat-history-toggle[aria-expanded="true"], .chat-history-toggle:hover { border-color: rgba(119,229,181,.32); color: var(--green); background: rgba(119,229,181,.07); }
  .chat-app-header p, .composer-hint { display: none; }
  .chat-header-actions { align-items: center; flex-direction: row; }
  .route-status { max-width: 190px; padding: 0 8px; }
  .route-status > span:not(.route-indicator) { display: none; }
  .new-chat-button { padding: 0 10px; }
  .modern-chat-messages { padding: 22px 0 calc(148px + env(safe-area-inset-bottom)); }
  .chat-workspace.is-empty .modern-chat-messages { padding: clamp(28px, 7vh, 64px) 0 20px; }
  .modern-chat-messages .chat-empty > strong { font-size: 27px; }
  .chat-empty-copy { font-size: 12px; }
  .modern-chat-messages .chat-message { gap: 10px; margin-bottom: 24px; }
  .chat-avatar { width: 29px; height: 29px; }
  .chat-message-body { max-width: calc(100% - 39px); }
  .modern-chat-messages .chat-message.user .chat-message-body { max-width: 88%; }
  .message-copy { opacity: 1; }
  .chat-composer-wrap { padding: 22px 0 max(8px, env(safe-area-inset-bottom)); }
  .modern-chat-form { padding: 8px 8px 7px; border-radius: 17px; }
  .modern-chat-form textarea { min-height: 44px; max-height: 140px; padding: 8px 9px 6px; font-size: 16px; }
  .scroll-latest { right: 8px; bottom: calc(126px + env(safe-area-inset-bottom)); }
  .chat-pet { right: 6px; bottom: calc(112px + env(safe-area-inset-bottom)); width: 100px; }
  .chat-workspace.is-empty .chat-pet { bottom: 12px; }
  .chat-pet-sprite { width: 88px; height: calc(88px * 208 / 192); }
  .chat-capability-warning { grid-template-columns: auto minmax(0, 1fr); }
  .chat-capability-warning a { grid-column: 2; justify-self: start; }
  .chat-attachment-gallery { grid-template-columns: 1fr; }
  .import-page .topbar { padding: 0 14px; gap: 10px; }
  .import-page .brand small, .import-page .service-state, .import-page .local-badge { display: none; }
  .import-page-shell { width: min(100% - 24px, 1240px); padding-top: 28px; }
  .import-hero { align-items: flex-start; flex-direction: column; gap: 18px; }
  .import-hero h1 { font-size: 38px; }
  .import-safety-note { width: 100%; min-width: 0; }
  .import-kind-tabs { gap: 5px; padding: 5px; }
  .import-kind-tab { min-height: 58px; justify-content: center; padding: 9px; text-align: center; }
  .import-kind-tab small, .import-kind-icon { display: none; }
  .import-kind-panel { padding: 20px; }
  .import-panel-heading { gap: 12px; padding-bottom: 18px; }
  .import-panel-heading h2 { font-size: 21px; }
  .mcp-method-tabs { overflow-x: auto; }
  .mcp-method-tab { flex: 0 0 auto; padding: 0 11px; }
  .mcp-json-editor, .mcp-json-guide { padding: 14px; }
  #mcp-json-input { min-height: 280px; }
  .local-source-grid { grid-template-columns: 1fr; }
  .method-intro { align-items: flex-start; flex-direction: column; gap: 5px; }
  .focused-import-form { padding: 15px; }
}

@media (max-width: 680px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .service-state, .local-badge { display: none; }
  .page { width: min(100% - 28px, 1480px); padding-top: 36px; }
  .hero { display: block; }
  .phase-card { margin-top: 28px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article { min-height: 108px; padding: 16px; }
  .metadata, .form-row, .playground-toolbar, .runtime-form-grid { grid-template-columns: 1fr; }
  .secret-controls { grid-template-columns: 1fr 1fr; }
  .secret-controls input { grid-column: 1 / -1; }
  .settings-heading { grid-template-columns: auto 1fr; }
  .settings-heading .count-badge { grid-column: 2; justify-self: start; }
  .validation-check { grid-template-columns: 1fr; gap: 4px; }
  .tool-upload-panel form { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .inventory-panel, .detail-panel, .form-panel, .audit-panel { padding: 18px; }
  .chat-message { max-width: 96%; }
  .chat-page .chat-header-actions { width: auto; align-items: center; flex-direction: row; }
  .chat-page .route-status { min-width: 0; }
  .chat-submit-row { align-items: stretch; flex-direction: column; }
  .security-grid { grid-template-columns: 1fr; }
  .login-card { padding: 26px; }
}

@media (max-width: 440px) {
  .topbar .brand > span:last-child { display: none; }
  .services-overview { align-items: stretch; flex-direction: column; gap: 16px; }
  .services-overview-actions { width: 100%; }
  .services-overview-actions > .button { flex: 1 1 0; }
  .service-summary article { padding: 11px 13px; }
  .service-summary strong { font-size: 21px; }
  .services-page .inventory-panel, .services-page .detail-panel, .services-page .audit-panel { padding: 17px; }
  .services-page .metadata { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .services-page .action-row { align-items: stretch; flex-direction: column; }
  .services-page .action-row .button { width: 100%; }
  .services-page .validation-check { grid-template-columns: 1fr; }
  .capability-list-header, .services-page .capability-card { grid-template-columns: 32px minmax(0, 1fr) 48px 68px; gap: 7px; }
  .services-page .capability-card { padding-left: 8px; padding-right: 8px; }
  .services-page .kind-icon { width: 32px; height: 32px; }
  .capability-card-status { min-width: 48px; }
  .capability-card-status small, .capability-availability { font-size: 9px; }
  .audit-page-heading { align-items: stretch; flex-direction: column; gap: 17px; }
  .audit-back-link { justify-content: center; }
  .audit-controls { padding: 17px; }
  .audit-filter-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .audit-filter-row .filter { min-width: 0; padding: 8px 2px; font-size: 10px; }
  .audit-record-panel { padding: 3px 17px; }
  .conversation-mark { display: none; }
  .chat-app-header h1 { max-width: 94px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .route-status { width: 36px; max-width: 36px; justify-content: center; padding: 0; }
  .route-status strong { display: none; }
  .new-chat-button { width: 36px; padding: 0; justify-content: center; }
  .new-chat-button span:last-child { display: none; }
  .empty-mark { width: 44px; height: 44px; margin-bottom: 13px; border-radius: 14px; }
  .modern-chat-messages .chat-empty > strong { font-size: 25px; }
  .chat-empty-copy { max-width: 260px; line-height: 1.5; }
  .attach-button { padding: 0 6px; }
  .composer-disclaimer { display: none; }
  .modern-chat-messages { padding-bottom: calc(126px + env(safe-area-inset-bottom)); }
  .chat-tool-activity { min-height: 106px; padding: 13px; }
  .tool-progress-heading { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .tool-progress-value { width: auto; min-width: 88px; }
  .import-hero .hero-copy { font-size: 13px; }
  .import-kind-tab strong { font-size: 11px; }
  .import-panel-heading .safe-state { display: none; }
  .field-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .json-file-name { width: 100%; margin-left: 0; }
}

/* Customer portal (8788): intentionally separate from management-console chrome. */
.portal-page, .portal-access-page {
  --portal-bg: #0b0b0c;
  --portal-panel: #121214;
  --portal-line: rgba(255,255,255,.09);
  --portal-muted: #8b8b91;
  --portal-text: #f3f3f4;
  --portal-hover: #242427;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--portal-text);
  background: var(--portal-bg);
}
html:has(body.portal-page), html:has(body.portal-access-page) { background: #0b0b0c; }
.portal-page .eyebrow, .portal-access-page .eyebrow { color: #aaaab0; }
.portal-shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 252px minmax(0, 1fr); overflow: hidden; }
.portal-sidebar { position: relative; min-height: 0; display: flex; flex-direction: column; padding: 15px 11px 12px; border-right: 1px solid var(--portal-line); background: #0e0e10; }
.portal-brand { min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--portal-text); text-decoration: none; }
.portal-brand-mark, .portal-access-mark { display: grid; place-items: center; color: #09090a; background: #f1f1f2; font-weight: 800; }
.portal-brand-mark { width: 32px; height: 28px; border-radius: 9px; font-size: 9px; letter-spacing: -.03em; }
.portal-brand strong, .portal-brand small { display: block; }
.portal-brand strong { font-size: 13px; font-weight: 650; }
.portal-brand small { margin-top: 2px; color: var(--portal-muted); font: 600 8px/1 monospace; letter-spacing: .08em; }
.portal-sidebar-collapse { position: absolute; top: 19px; right: 12px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 9px; color: var(--portal-muted); background: transparent; cursor: pointer; }
.portal-sidebar-collapse:hover, .portal-sidebar-collapse:focus-visible { color: var(--portal-text); border-color: var(--portal-line); background: var(--portal-hover); }
.portal-sidebar-collapse svg { width: 19px; height: 19px; }
.portal-history-toggle, .portal-session-scrim { display: none; }
.portal-history-toggle { min-height: 36px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--portal-line); border-radius: 10px; color: var(--portal-text); background: #171719; font-size: 11px; cursor: pointer; }
.portal-history-toggle:hover, .portal-history-toggle[aria-expanded="true"] { background: #202023; }
.portal-history-icon { width: 15px; display: grid; gap: 3px; }
.portal-history-icon i { display: block; height: 1px; border-radius: 999px; background: currentColor; }
.portal-new-chat { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 9px; margin-top: 10px; padding: 0 12px; border: 1px solid var(--portal-line); border-radius: 11px; color: var(--portal-text); background: #171719; font-size: 12px; cursor: pointer; }
.portal-new-chat:hover { background: #202023; }
.portal-new-chat span { font-size: 18px; font-weight: 300; }
.portal-history-heading { padding: 22px 10px 8px; color: #68686e; font-size: 10px; font-weight: 650; }
.portal-history-search { min-height: 37px; display: flex; align-items: center; gap: 6px; margin: 0 2px 9px; padding: 0 10px; border: 1px solid var(--portal-line); border-radius: 9px; color: var(--portal-muted); background: #171719; }
.portal-history-search:focus-within { border-color: #777d88; }
.portal-history-search span { font-size: 20px; line-height: 1; }
.portal-history-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--portal-text); background: transparent; font-size: 12px; }
.portal-history-search input::placeholder { color: var(--portal-muted); }
.portal-session-list { flex: 1 1 auto; min-height: 0; padding: 0; }
.portal-session-group { margin: 13px 9px 4px; color: var(--portal-muted); font-size: 10px; font-weight: 600; }
.portal-history-more { width: 100%; min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--portal-muted); background: transparent; text-align: left; cursor: pointer; font-size: 11px; }
.portal-history-more:hover { color: var(--portal-text); background: var(--portal-hover); }
.portal-session-menu-toggle { position: absolute; z-index: 2; top: 50%; right: 7px; width: 28px; height: 28px; translate: 0 -50%; border: 0; border-radius: 7px; color: var(--portal-muted); background: transparent; cursor: pointer; font-size: 19px; line-height: 1; opacity: 0; }
.portal-session-list .session-entry:hover .portal-session-menu-toggle, .portal-session-list .session-entry:focus-within .portal-session-menu-toggle, .portal-session-list .session-entry.active .portal-session-menu-toggle { opacity: 1; }
.portal-session-menu-toggle:hover, .portal-session-menu-toggle[aria-expanded="true"] { color: var(--portal-text); background: var(--portal-hover); }
.portal-session-menu { position: absolute; z-index: 10; top: calc(50% + 13px); right: 5px; width: 128px; padding: 4px; border: 1px solid var(--portal-line); border-radius: 10px; background: #252529; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.portal-session-menu[hidden] { display: none; }
.portal-session-menu button { width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: 6px; color: var(--portal-text); background: transparent; text-align: left; cursor: pointer; font-size: 11px; }
.portal-session-menu button:hover { background: var(--portal-hover); }
.portal-session-menu button:disabled { opacity: .4; cursor: not-allowed; }
.portal-session-menu .danger:hover { color: #ff9090; }
.portal-session-rename { width: calc(100% - 42px); min-height: 30px; margin: 3px 5px; padding: 3px 7px; border: 1px solid #787880; border-radius: 6px; color: var(--portal-text); background: #252529; font-size: 11px; }
.portal-session-list .session-entry { margin: 2px 0; }
.portal-session-list .session-item { border-radius: 9px; color: #bdbdc2; }
.portal-session-list .session-item:hover, .portal-session-list .session-item.active { color: var(--portal-text); background: #1a1a1d; }
.portal-session-list .session-entry:hover .session-item-heading strong, .portal-session-list .session-entry:focus-within .session-item-heading strong { overflow: visible; white-space: normal; overflow-wrap: anywhere; }
.portal-session-list .session-delete { color: #6f6f75; }
@media (min-width: 801px) {
  .portal-page.portal-sidebar-collapsed .portal-shell { grid-template-columns: 64px minmax(0, 1fr); }
  .portal-page.portal-sidebar-collapsed .portal-sidebar { align-items: center; padding-left: 8px; padding-right: 8px; }
  .portal-page.portal-sidebar-collapsed .portal-brand { width: 44px; justify-content: center; padding: 4px; }
  .portal-page.portal-sidebar-collapsed .portal-brand > span:last-child,
  .portal-page.portal-sidebar-collapsed .portal-history-heading,
  .portal-page.portal-sidebar-collapsed .portal-history-search,
  .portal-page.portal-sidebar-collapsed .portal-session-list,
  .portal-page.portal-sidebar-collapsed .portal-account-copy,
  .portal-page.portal-sidebar-collapsed .portal-account-chevron { display: none; }
  .portal-page.portal-sidebar-collapsed .portal-sidebar-collapse { top: 65px; right: auto; }
  .portal-page.portal-sidebar-collapsed .portal-sidebar-collapse svg { transform: scaleX(-1); }
  .portal-page.portal-sidebar-collapsed .portal-new-chat { width: 40px; min-height: 40px; justify-content: center; margin-top: 56px; padding: 0; overflow: hidden; font-size: 0; }
  .portal-page.portal-sidebar-collapsed .portal-new-chat span { font-size: 20px; }
  .portal-page.portal-sidebar-collapsed .portal-account { width: 44px; display: flex; justify-content: center; padding: 10px 0 2px; }
}
.portal-account { flex: 0 0 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; padding: 10px 7px 2px; border-top: 1px solid var(--portal-line); }
.portal-account-copy { min-width: 0; }
.portal-account-copy strong, .portal-account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-account-copy strong { font-size: 11px; font-weight: 600; }
.portal-account-copy small { margin-top: 3px; color: var(--portal-muted); font-size: 8px; }
.portal-account a, .portal-account button, .portal-settings-header a, .portal-settings-header button { padding: 6px; border: 0; color: var(--portal-muted); background: transparent; font-size: 10px; text-decoration: none; cursor: pointer; }
.portal-account a:hover, .portal-account button:hover, .portal-settings-header a:hover, .portal-settings-header button:hover { color: var(--portal-text); }
.portal-chat-workspace { height: 100vh; height: 100dvh; background: var(--portal-bg); }
.portal-chat-header { min-height: 62px; padding: 9px 18px; border-color: var(--portal-line); }
.portal-chat-header .conversation-mark { border-color: var(--portal-line); color: #151517; background: #efeff0; }
.portal-chat-header .conversation-mark { width: 40px; height: 40px; }
.portal-chat-messages .chat-avatar { width: 38px; height: 38px; }
.portal-route-status { border-color: var(--portal-line); color: var(--portal-muted); background: #111113; cursor: default; }
.portal-route-status:hover { border-color: var(--portal-line); color: var(--portal-muted); }
.portal-route-status .route-indicator { background: #a1a1a6; box-shadow: none; }
.portal-service-state { color: var(--portal-muted); }
.portal-chat-messages { padding-left: 24px; padding-right: 24px; scrollbar-color: rgba(255,255,255,.22) transparent; }
.portal-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); background-clip: padding-box; }
.portal-chat-messages .chat-message { width: min(760px, 100%); }
.portal-chat-messages .chat-message.user .chat-message-body { border-color: var(--portal-line); background: #1c1c1f; }
.portal-chat-messages .rich-content { color: #ececef; }
.portal-composer-wrap { padding-left: 24px; padding-right: 24px; background: linear-gradient(180deg, rgba(11,11,12,0), var(--portal-bg) 34%); }
.portal-chat-form { width: min(760px, 100%); border-color: rgba(255,255,255,.17); background: #18181a; box-shadow: 0 16px 50px rgba(0,0,0,.4); }
.portal-chat-form:focus-within { border-color: rgba(255,255,255,.32); box-shadow: 0 18px 56px rgba(0,0,0,.45), 0 0 0 3px rgba(255,255,255,.025); }
.portal-chat-form textarea::placeholder { color: #77777d; }
.portal-page .chat-send { color: #111113; background: #eeeeef; }
.portal-page .chat-send:hover:not(:disabled) { background: white; }
.portal-page .chat-capability-warning { border-color: rgba(255,190,105,.2); background: rgba(255,190,105,.045); }
.portal-page .attachment-boundary { display: none; }

.portal-access-page { position: relative; isolation: isolate; display: grid; place-items: center; min-height: 100svh; padding: 36px; overflow-x: hidden; background: radial-gradient(circle at 18% 65%, rgba(46,65,107,.35), transparent 38%), radial-gradient(circle at 83% 9%, rgba(51,85,94,.27), transparent 33%), #090a10; }
.portal-access-page::before { inset: -20%; background: radial-gradient(ellipse at 26% 58%, rgba(87,105,219,.18), transparent 31%), radial-gradient(ellipse at 74% 33%, rgba(67,205,185,.13), transparent 29%), radial-gradient(ellipse at 51% 86%, rgba(157,102,203,.13), transparent 30%); filter: blur(40px); animation: access-aurora 22s ease-in-out infinite alternate; }
.portal-access-page::after { inset: -10%; opacity: .86; background-image: radial-gradient(circle at 5% 12%, #b9c7ff 0 1px, transparent 2.5px), radial-gradient(circle at 12% 72%, #9de6e1 0 1.5px, transparent 3px), radial-gradient(circle at 18% 35%, #e2daff 0 1px, transparent 2.5px), radial-gradient(circle at 24% 89%, #b5c6ff 0 1px, transparent 3px), radial-gradient(circle at 29% 9%, #92dcd2 0 1.5px, transparent 3px), radial-gradient(circle at 35% 53%, #d5cbff 0 1px, transparent 2.5px), radial-gradient(circle at 42% 23%, #9de7df 0 1px, transparent 3px), radial-gradient(circle at 47% 79%, #c4d5ff 0 1.5px, transparent 3px), radial-gradient(circle at 53% 41%, #ebe5ff 0 1px, transparent 2.5px), radial-gradient(circle at 58% 6%, #b2d5fc 0 1px, transparent 3px), radial-gradient(circle at 64% 67%, #9ee5de 0 1px, transparent 3px), radial-gradient(circle at 69% 29%, #d9cbff 0 1.5px, transparent 3px), radial-gradient(circle at 75% 91%, #abc8ff 0 1px, transparent 2.5px), radial-gradient(circle at 82% 14%, #b7e8e7 0 1px, transparent 3px), radial-gradient(circle at 88% 58%, #e3d8ff 0 1.5px, transparent 3px), radial-gradient(circle at 95% 36%, #a3c3fc 0 1px, transparent 3px); animation: access-particles-drift 24s ease-in-out infinite alternate; }
.portal-access-shell { position: relative; z-index: 1; width: min(100%, 1060px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 440px); align-items: center; gap: clamp(36px, 7vw, 112px); }
.access-intro { max-width: 520px; padding: 38px 0; }
.access-intro-kicker { display: flex; align-items: center; gap: 10px; margin: 0; color: #9fb3bb; font: 700 11px/1.4 monospace; letter-spacing: .13em; }
.access-intro-kicker span { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #a8ebd7; box-shadow: 0 0 16px rgba(168,235,215,.8); }
.access-intro h2 { margin: 27px 0 20px; color: #f0f0f6; font-size: clamp(43px, 5vw, 70px); font-weight: 560; line-height: 1.15; letter-spacing: -.06em; }
.access-intro h2 em { color: #b8c9ff; font-style: normal; }
.access-intro > p:not(.access-intro-kicker) { max-width: 390px; color: #a5a8b7; font-size: 15px; line-height: 1.8; }
.access-intro-tags { display: flex; gap: 10px; margin-top: 34px; }
.access-intro-tags span { padding: 7px 12px; border: 1px solid rgba(184,201,255,.21); border-radius: 999px; color: #b5bfd6; background: rgba(155,166,215,.05); font-size: 11px; }
.portal-access-card { padding: 36px; border: 1px solid rgba(205,211,238,.18); border-radius: 24px; background: linear-gradient(155deg, rgba(26,27,38,.9), rgba(16,17,24,.93)); box-shadow: 0 30px 100px rgba(0,0,0,.52), inset 0 1px rgba(255,255,255,.055); backdrop-filter: blur(24px); }
.portal-register-card { padding-top: 29px; padding-bottom: 29px; }
.portal-register-card .portal-access-mark { margin-bottom: 17px; }
.portal-register-card .portal-access-form { margin-top: 18px; }
.portal-register-card .portal-access-switch { margin-top: 14px; }
.portal-register-card .stack-form { gap: 12px; }
.portal-register-card .stack-form label { gap: 5px; }
.portal-register-card .portal-access-form input { min-height: 42px; }
.portal-register-card .portal-code-row .button { min-height: 42px; }
.portal-register-card h1 { font-size: 27px; }
.portal-access-page .portal-access-card { max-width: 440px; width: 100%; }
.portal-access-page .portal-access-mark { box-shadow: 0 8px 28px rgba(0,0,0,.25); }
@keyframes access-particles-drift { from { transform: translate3d(-2%, 2%, 0) rotate(-2deg); opacity: .55; } to { transform: translate3d(3%, -3%, 0) rotate(2deg); opacity: 1; } }
@keyframes access-aurora { from { transform: translate3d(-3%, 1%, 0) scale(1); opacity: .64; } to { transform: translate3d(3%, -2%, 0) scale(1.12); opacity: 1; } }
@keyframes access-control-grid { from { background-position: 0 0; opacity: .42; } to { background-position: 0 76px; opacity: .8; } }
.portal-access-mark { width: 46px; height: 42px; margin-bottom: 24px; border-radius: 13px; font-size: 11px; letter-spacing: -.03em; }
.password-input-wrap { position: relative; display: block; }
.password-input-wrap input { width: 100%; padding-right: 64px; }
.password-visibility {
  position: absolute;
  top: 50%;
  right: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #a8a8ad;
  background: transparent;
  cursor: pointer;
}
.password-visibility:hover { color: #f1f1f2; background: rgba(255, 255, 255, .06); }
.password-visibility:focus-visible { outline: 2px solid rgba(255, 255, 255, .72); outline-offset: 2px; }
.password-eye-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-eye-slash { display: none; }
.password-visibility.is-visible .password-eye-slash { display: block; }
.portal-access-card h1 { margin: 5px 0 8px; font-size: 29px; letter-spacing: -.035em; }
.portal-access-card > p:not(.eyebrow):not(.login-error):not(.portal-form-message):not(.portal-access-switch) { margin: 0 0 25px; color: var(--portal-muted); font-size: 13px; line-height: 1.6; }
.portal-access-form { margin-top: 24px; }
.portal-access-form input, .portal-settings-card input { min-height: 44px; border-color: var(--portal-line); color: var(--portal-text); background: #0e0e10; }
.portal-access-form .button.primary, .portal-settings-card .button.primary { color: #101012; background: #f0f0f1; }
.portal-code-row { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
.portal-code-row .button { min-height: 44px; padding: 0 10px; white-space: nowrap; }
.portal-code-row .button.secondary { border-color: var(--portal-line); color: #d7d7da; background: #1a1a1d; }
.portal-access-switch { margin: 22px 0 0; color: var(--portal-muted); font-size: 12px; text-align: center; }
.portal-access-switch a { color: var(--portal-text); }
.portal-access-switch a.disabled { color: #66666b; cursor: not-allowed; text-decoration: none; }
.portal-form-message { margin: 14px 0 0; color: #8fd7ad; font-size: 11px; line-height: 1.5; }

.portal-settings-header { height: 58px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--portal-line); }
.portal-settings-loading-message { display: none; margin: 48px auto; color: var(--portal-muted); text-align: center; font-size: 13px; }
.settings-loading .portal-settings-loading-message { display: block; }
.settings-loading .portal-settings-shell { visibility: hidden; }
.portal-chat-workspace[hidden], .portal-settings-workspace[hidden] { display: none; }
.portal-settings-workspace { min-width: 0; min-height: 0; height: 100dvh; overflow: hidden; background: var(--portal-bg); }
.portal-settings-workspace iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--portal-bg); }
.settings-embedded .portal-settings-shell { width: min(100% - 48px, 920px); padding-top: 36px; }
.portal-settings-header strong { justify-self: center; font-size: 13px; }
.portal-settings-header button { justify-self: end; }
.portal-settings-shell { width: min(100% - 36px, 680px); margin: 0 auto; padding: 58px 0 80px; }
.portal-settings-intro { margin-bottom: 28px; }
.portal-settings-intro h1 { margin: 5px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.portal-settings-intro > p:last-child, .portal-settings-card > p { color: var(--portal-muted); font-size: 12px; }
.portal-settings-card { margin-top: 16px; padding: 24px; border: 1px solid var(--portal-line); border-radius: 17px; background: var(--portal-panel); }
.portal-settings-card h2 { margin: 0 0 18px; font-size: 16px; }
.portal-settings-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.portal-settings-card-heading h2 { margin-bottom: 7px; }
.portal-settings-card-heading p { margin: 0; color: var(--portal-muted); font-size: 12px; line-height: 1.55; }
.portal-toggle { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 32px; color: var(--portal-muted); font-size: 11px; cursor: pointer; }
.portal-toggle input { position: absolute; width: 1px; height: 1px; min-height: 0 !important; opacity: 0; pointer-events: none; }
.portal-toggle-track { position: relative; display: inline-flex; align-items: center; width: 38px; height: 22px; padding: 3px; border: 1px solid var(--portal-line); border-radius: 999px; background: var(--portal-hover); transition: .18s ease; }
.portal-toggle-track span { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--portal-muted); transition: transform .18s ease, background .18s ease; }
.portal-toggle input:checked + .portal-toggle-track { border-color: rgba(119,229,181,.5); background: rgba(119,229,181,.15); }
.portal-toggle input:checked + .portal-toggle-track span { background: var(--green); transform: translateX(16px); }
.portal-toggle input:focus-visible + .portal-toggle-track { outline: 2px solid var(--portal-muted); outline-offset: 2px; }
.portal-toggle strong { min-width: 38px; color: var(--portal-text); font-size: 11px; font-weight: 600; }
.chat-pet-gallery { display: grid; gap: 20px; margin-top: 22px; }
.chat-pet-gallery-group { min-width: 0; }
.chat-pet-gallery-group h2 { margin: 0 0 10px; color: var(--portal-muted); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.chat-pet-gallery-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.chat-pet-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 9px; min-width: 0; min-height: 74px; padding: 8px 10px; border: 1px solid var(--portal-line); border-radius: 12px; color: var(--portal-text); background: var(--portal-hover); text-align: left; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.chat-pet-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chat-pet-card.is-selected { border-color: rgba(119,229,181,.56); background: rgba(119,229,181,.1); box-shadow: 0 0 0 1px rgba(119,229,181,.12); }
.chat-pet-card:focus-visible { outline: 2px solid var(--portal-muted); outline-offset: 2px; }
.chat-pet-card-sprite { grid-row: 1 / -1; width: 48px; height: 52px; background-repeat: no-repeat; background-size: 600% 100%; background-position: calc(var(--pet-frame, 0) * 100% / 5) center; }
.chat-pet-gallery-group.is-girl .chat-pet-card { grid-template-columns: 62px minmax(0, 1fr); min-height: 86px; }
.chat-pet-gallery-group.is-girl .chat-pet-card-sprite { width: 62px; height: 67px; }
.chat-pet-card strong { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.chat-pet-card small { overflow: hidden; margin-top: 3px; color: var(--portal-muted); font-size: 9px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.portal-account-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 22px; }
.portal-account-details div { padding: 12px; border: 1px solid var(--portal-line); border-radius: 11px; background: #0e0e10; }
.portal-account-details dt { color: var(--portal-muted); font-size: 9px; }
.portal-account-details dd { margin: 5px 0 0; overflow: hidden; color: var(--portal-text); font-size: 12px; text-overflow: ellipsis; }

.portal-account { display: block; }
.portal-account #portal-account-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 7px; border-radius: 11px; color: var(--portal-text); text-align: left; }
.portal-account #portal-account-toggle:hover, .portal-account #portal-account-toggle[aria-expanded="true"] { background: var(--portal-hover); }
.portal-user-avatar { flex: 0 0 32px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--portal-line); border-radius: 50%; background: var(--portal-hover); color: var(--portal-text); font-size: 12px; font-weight: 650; }
.portal-account-copy { flex: 1; }
.portal-account-chevron { width: 18px; height: 18px; color: var(--portal-muted); }
.portal-account-menu { position: fixed; z-index: 230; width: min(270px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow-y: auto; padding: 7px; border: 1px solid var(--portal-line); border-radius: 15px; color: var(--portal-text); background: var(--portal-panel); box-shadow: 0 16px 55px rgba(0,0,0,.28); }
.portal-account-menu[hidden], .portal-theme-options[hidden], [data-settings-panel][hidden] { display: none; }
.portal-account-menu > a, .portal-account-menu > button { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 42px; padding: 10px 12px; border: 0; border-radius: 9px; color: inherit; background: transparent; font: inherit; font-size: 13px; text-decoration: none; text-align: left; cursor: pointer; }
.portal-account-menu > a:hover, .portal-account-menu > button:hover:not([aria-disabled="true"]) { background: var(--portal-hover); }
.portal-account-menu svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.portal-account-menu small { margin-left: auto; color: var(--portal-muted); font-size: 11px; }
.portal-account-menu [aria-disabled="true"] { opacity: .52; cursor: default; }
.portal-account-menu a:focus-visible, .portal-account-menu button:focus-visible, #portal-account-toggle:focus-visible { outline: 2px solid var(--portal-muted); outline-offset: -2px; }
.portal-menu-divider { height: 1px; margin: 5px 7px; background: var(--portal-line); }
.portal-theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 9px 8px; padding: 4px; border: 1px solid var(--portal-line); border-radius: 10px; }
.portal-theme-options button { padding: 7px; border: 0; border-radius: 6px; color: var(--portal-muted); background: transparent; font-size: 12px; cursor: pointer; }
.portal-theme-options [aria-pressed="true"] { color: var(--portal-text); background: var(--portal-hover); }
.portal-version-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; }
.portal-version-row strong { padding: 6px 10px; border-radius: 7px; background: var(--portal-hover); font: 12px ui-monospace, monospace; }
.portal-settings-card .portal-about-copy { margin: 0; line-height: 1.9; font-size: 13px; }
.portal-settings-card textarea { width: 100%; min-height: 104px; padding: 12px; resize: vertical; border: 1px solid var(--portal-line); border-radius: 10px; background: #0e0e10; color: var(--portal-text); font: inherit; font-size: 13px; }
.portal-capability-list { display: grid; gap: 10px; margin-top: 16px; }
.portal-capability-item { padding: 14px; border: 1px solid var(--portal-line); border-radius: 12px; background: rgba(127, 127, 127, .045); }
.portal-capability-item p { margin: 7px 0 0; color: var(--portal-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.portal-knowledge-list { display: grid; gap: 10px; margin-top: 20px; }
.portal-knowledge-item { padding: 14px; border: 1px solid var(--portal-line); border-radius: 12px; background: rgba(127, 127, 127, .045); }
.portal-knowledge-item strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.portal-knowledge-item p { margin: 8px 0; color: var(--portal-muted); font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-knowledge-item small { color: var(--portal-muted); }
.portal-knowledge-actions, .portal-settings-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-knowledge-actions .button { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.portal-checkbox { display: flex !important; align-items: center; gap: 9px; }
.portal-checkbox input { min-height: 0 !important; width: 17px; height: 17px; }
.knowledge-admin-page { padding-top: 42px; }
.knowledge-admin-grid { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 18px; align-items: start; }
.knowledge-admin-grid .panel { min-width: 0; padding: 24px; }
.knowledge-admin-grid .stack-form { display: grid; gap: 13px; }
.knowledge-admin-grid .stack-form input, .knowledge-admin-grid .stack-form textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--portal-line); border-radius: 9px; color: var(--portal-text); background: #111315; font: inherit; }
.knowledge-admin-grid .stack-form select, .portal-settings-card select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--portal-line); border-radius: 9px; color: var(--portal-text); background: #111315; font: inherit; }
.knowledge-admin-grid .stack-form textarea { resize: vertical; }
.knowledge-admin-grid .stack-form label { display: grid; gap: 7px; font-size: 13px; }
#library-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
#library-form > label { grid-column: 1; grid-row: 1; }
#library-form > button { grid-column: 2; grid-row: 1; min-height: 42px; }
#library-description-details { grid-column: 1 / -1; grid-row: 2; }
#library-description-details > label { margin-top: 12px; }
.knowledge-prerequisite { margin: 18px 0 0; padding: 11px 14px; border: 1px solid rgba(119,229,181,.18); border-radius: 9px; color: var(--portal-muted); background: rgba(119,229,181,.04); font-size: 12px; }
.knowledge-prerequisite[hidden] { display: none; }
.knowledge-admin-grid #library-content[inert] .knowledge-admin-section { opacity: .53; }
.knowledge-library-choice { display: grid; gap: 4px; width: 100%; padding: 13px; border: 1px solid var(--portal-line); border-radius: 10px; text-align: left; color: var(--portal-text); background: rgba(127,127,127,.04); cursor: pointer; }
.knowledge-library-choice.is-active { border-color: #6ccaa0; background: rgba(108,202,160,.1); }
.knowledge-library-choice small { color: var(--portal-muted); }
.knowledge-admin-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--portal-line); }
.knowledge-optional > summary, .knowledge-advanced > summary { color: var(--portal-text); cursor: pointer; font-size: 12px; }
.knowledge-optional > summary { font-weight: 600; }
.knowledge-optional[open] > form, .knowledge-advanced[open] > label { margin-top: 15px; }
.knowledge-optional[hidden], .knowledge-quick-category[hidden] { display: none; }
.knowledge-advanced { padding: 10px 0; }
.knowledge-advanced > label { display: grid; gap: 8px; margin-top: 12px; }
.knowledge-category-picker { display: flex; align-items: end; gap: 10px; margin-top: 20px; }
.knowledge-category-picker label { flex: 1; display: grid; gap: 7px; color: var(--portal-muted); font-size: 12px; }
.knowledge-category-picker select { min-height: 42px; padding: 9px 11px; border: 1px solid var(--portal-line); border-radius: 9px; color: var(--portal-text); background: #111315; }
.knowledge-category-picker button { flex: 0 0 auto; min-height: 42px; }
.knowledge-quick-category { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto; align-items: end; gap: 8px; margin-top: 10px; }
.knowledge-quick-category label { display: grid; gap: 6px; min-width: 0; color: var(--portal-muted); font-size: 12px; }
.knowledge-quick-category input, .knowledge-quick-category select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid var(--portal-line); border-radius: 9px; color: var(--portal-text); background: #111315; }
.knowledge-quick-category button { min-height: 42px; }
.knowledge-import-card { margin-top: 14px; padding: 16px; border: 1px dashed var(--portal-line); border-radius: 12px; background: rgba(255,255,255,.025); }
.knowledge-import-card .knowledge-file-picker { margin: 0 0 8px; }
.knowledge-import-card .panel-copy { margin: 0; }
.knowledge-inline-manager { margin: 10px 0 0; }
.knowledge-inline-manager .stack-form { margin-top: 14px; }
.knowledge-inline-manager .portal-knowledge-list { margin-top: 12px; }
.knowledge-file-picker { position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 42px; margin: 14px 0 8px; padding: 0 16px; border: 1px solid var(--portal-line); border-radius: 10px; color: var(--portal-text); background: var(--portal-hover); font-size: 12px; font-weight: 600; cursor: pointer; }
.knowledge-file-picker::before { content: "+"; font-size: 18px; font-weight: 400; line-height: 1; }
.knowledge-file-picker:hover { border-color: var(--portal-muted); }
.knowledge-file-picker:focus-within { outline: 2px solid var(--portal-muted); outline-offset: 2px; }
.knowledge-file-picker input, .portal-settings-card .knowledge-file-picker input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; opacity: 0; }
.knowledge-admin-section h3 { margin: 0 0 8px; font-size: 15px; }
.knowledge-assistant-list { display: grid; gap: 8px; margin: 12px 0; }
.knowledge-assistant-option { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--portal-line); border-radius: 9px; }
.knowledge-assistant-option input { width: 16px; height: 16px; }
@media (max-width: 760px) { .knowledge-admin-grid { grid-template-columns: 1fr; } .knowledge-admin-grid .panel { padding: 18px; } }
@media (max-width: 760px) { .knowledge-quick-category { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { #library-form { grid-template-columns: 1fr; } #library-form > label { grid-column: 1; grid-row: 1; } #library-form > button { grid-column: 1; grid-row: 2; } #library-description-details { grid-column: 1; grid-row: 3; } }
@media (max-width: 560px) { .knowledge-category-picker { flex-wrap: wrap; } .knowledge-category-picker label { flex-basis: 100%; } .knowledge-quick-category { grid-template-columns: 1fr; } }
.portal-capability-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-capability-heading strong { min-width: 0; overflow-wrap: anywhere; }
.portal-capability-identity { display: grid; gap: 2px; min-width: 0; }
.portal-capability-identity small { color: var(--portal-muted); font-size: 11px; }
.portal-capability-status { flex: none; font-size: 11px; color: var(--portal-muted); }
.portal-capability-status.is-available { color: #61d4a3; }
.portal-capability-status.is-unavailable { color: #e6ae83; }
.portal-capability-credentials { margin-top: 12px; }
.portal-capability-recheck { margin-top: 12px; }
.portal-capability-credentials summary { cursor: pointer; color: var(--portal-text); font-size: 12px; }
.portal-mcp-authorization-form { margin-top: 12px; }
.portal-mcp-authorization-form button { justify-self: start; }

html[data-portal-theme="light"]:has(body.portal-page), html[data-portal-theme="light"]:has(body.portal-access-page) { background: #fff; }
html[data-portal-theme="light"] :is(.portal-page, .portal-access-page) {
  --portal-bg: #fff; --portal-panel: #fff; --portal-line: #e1e3e7; --portal-muted: #696e78; --portal-text: #20232a; --portal-hover: #f0f1f3;
  --bg: #fff; --text: #20232a; --muted: #696e78; --line: #e1e3e7; --line-strong: #b8bec7; --surface-soft: #f4f5f7;
  --green: #16704b; --blue: #225fac; --amber: #926317; --red: #ad3434;
  color: var(--portal-text); background: var(--portal-bg); color-scheme: light;
}
html[data-portal-theme="light"] :is(.portal-sidebar, .portal-session-list) { background: #f7f7f8; }
html[data-portal-theme="light"] :is(.portal-new-chat, .portal-history-toggle, .portal-route-status, .portal-chat-form, .portal-account-details div, .portal-access-form input, .portal-settings-card input) { color: var(--portal-text); background: #fff; border-color: var(--portal-line); }
html[data-portal-theme="light"] .portal-settings-card textarea { color: var(--portal-text); background: #fff; border-color: var(--portal-line); }
html[data-portal-theme="light"] :is(.portal-new-chat:hover, .portal-history-toggle:hover, .portal-session-list .session-item:hover, .portal-session-list .session-item.active) { color: var(--portal-text); background: #eaecef; }
html[data-portal-theme="light"] .portal-session-list .session-item { color: #4a505b; }
html[data-portal-theme="light"] .portal-history-search { background: #f3f4f6; }
html[data-portal-theme="light"] .portal-session-menu, html[data-portal-theme="light"] .portal-session-rename { background: #fff; }
html[data-portal-theme="light"] .portal-chat-messages .chat-message.user .chat-message-body { background: #f0f1f4; }
html[data-portal-theme="light"] .portal-chat-messages { scrollbar-color: #aeb5c0 transparent; }
html[data-portal-theme="light"] .portal-chat-messages::-webkit-scrollbar-thumb { background: #aeb5c0; background-clip: padding-box; }
html[data-portal-theme="light"] :is(.portal-chat-messages .rich-content, .portal-chat-messages .rich-content strong, .portal-chat-form textarea, .route-status strong) { color: var(--portal-text); }
html[data-portal-theme="light"] :is(.chat-empty-copy, .chat-app-header p, .attach-button, .composer-hint, .composer-disclaimer, .chat-message-footer .chat-meta, .session-item-meta) { color: var(--portal-muted); }
html[data-portal-theme="light"] .portal-composer-wrap { background: linear-gradient(180deg, rgba(255,255,255,0), #fff 34%); }
html[data-portal-theme="light"] .portal-chat-form { box-shadow: 0 8px 32px rgba(30,40,60,.08); }
html[data-portal-theme="light"] .portal-chat-form:focus-within { border-color: #a7aeb8; box-shadow: 0 8px 32px rgba(30,40,60,.1); }
html[data-portal-theme="light"] :is(.portal-page .chat-send, .portal-access-form .button.primary, .portal-settings-card .button.primary, .portal-brand-mark, .portal-access-mark) { color: #fff; background: #242830; }
html[data-portal-theme="light"] .portal-page .chat-send:hover:not(:disabled) { background: #3c424e; }
html[data-portal-theme="light"] :is(.chat-avatar:not(.has-image), .empty-mark, .empty-mark span, .conversation-mark:not(.has-image)) { color: #246045; background: #eef5f1; border-color: #d1e3d7; box-shadow: none; }
html[data-portal-theme="light"] :is(.rich-content pre, .chat-attachment pre, .rich-content code, .copy-code, .chat-attachment, .pending-attachment, .chat-video-artifact) { color: #293241; background: #f5f6f8; border-color: #dde1e7; }
html[data-portal-theme="light"] :is(.rich-content th, .rich-content td, .rich-content blockquote) { color: #414956; border-color: #d5dbe2; }
html[data-portal-theme="light"] .rich-content a { color: #245fb2; }
html[data-portal-theme="light"] :is(.hljs-string, .hljs-attr, .hljs-template-tag) { color: #25623b; }
html[data-portal-theme="light"] :is(.hljs-keyword, .hljs-selector-tag, .hljs-literal) { color: #9b3261; }
html[data-portal-theme="light"] :is(.hljs-title, .hljs-section, .hljs-function) { color: #225fa9; }
html[data-portal-theme="light"] :is(.hljs-number, .hljs-symbol, .hljs-variable) { color: #875811; }
html[data-portal-theme="light"] .chat-tool-activity { background: #f2f7f4; border-color: #cce1d4; box-shadow: none; }
html[data-portal-theme="light"] .tool-progress-title { color: #284e39; }
html[data-portal-theme="light"] .tool-progress-value { color: #29633e; background: #e6f1e9; }
html[data-portal-theme="light"] .tool-progress-track { background: #dce8e0; box-shadow: none; }
html[data-portal-theme="light"] :is(.scroll-latest, .toast, .chat-stop, .portal-code-row .button.secondary) { color: #303640; background: #f1f3f5; border-color: #d6dce3; }
html[data-portal-theme="light"] .chat-pet-status { color: #3a424c; background: rgba(255,255,255,.94); border-color: #d6dce3; }
html[data-portal-theme="light"] .chat-pet[data-state="running"] .chat-pet-status { color: #16704b; border-color: #b7dcc8; }
html[data-portal-theme="light"] .chat-pet[data-state="waiting"] .chat-pet-status { color: #926317; border-color: #ead4a4; }
html[data-portal-theme="light"] .chat-pet[data-state="review"] .chat-pet-status { color: #225fac; border-color: #c5d5ee; }
html[data-portal-theme="light"] .chat-pet[data-state="failed"] .chat-pet-status { color: #ad3434; border-color: #ecc0c0; }
html[data-portal-theme="light"] .portal-access-card { background: #fff; box-shadow: 0 18px 65px rgba(30,40,60,.08); }
html[data-portal-theme="light"] body.portal-access-page { background: radial-gradient(circle at 16% 50%, rgba(156,181,229,.25), transparent 38%), radial-gradient(circle at 86% 8%, rgba(143,216,212,.19), transparent 34%), #f6f8fc; }
html[data-portal-theme="light"] .portal-access-page::after { filter: invert(1); opacity: .25; }
html[data-portal-theme="light"] .portal-access-page::before { opacity: .4; }
html[data-portal-theme="light"] .access-intro h2 { color: #252f42; }
html[data-portal-theme="light"] .access-intro h2 em { color: #5264a8; }
html[data-portal-theme="light"] .access-intro > p:not(.access-intro-kicker), html[data-portal-theme="light"] .access-intro-kicker { color: #5d6679; }
html[data-portal-theme="light"] .access-intro-tags span { color: #526079; border-color: rgba(76,94,154,.2); background: rgba(91,106,170,.045); }
html[data-portal-theme="light"] .password-visibility { color: #606774; }
html[data-portal-theme="light"] .password-visibility:hover { color: #20232a; background: #f0f1f3; }

@media (max-width: 850px) {
  .login-shell, .portal-access-shell { width: min(100%, 440px); display: block; }
  .login-intro, .access-intro { display: none; }
}
@media (max-width: 560px) {
  .login-page { padding: 16px; }
  .login-card { padding: 27px 22px; }
  .portal-access-page::after, .login-page::after { opacity: .5; }
}
@media (prefers-reduced-motion: reduce) {
  .login-page::before, .login-page::after, .portal-access-page::before, .portal-access-page::after { animation: none; }
}

@media (max-width: 800px) {
  .portal-shell { grid-template-columns: 1fr; grid-template-rows: 58px minmax(0, 1fr); }
  .portal-sidebar { position: relative; z-index: 83; flex-direction: row; align-items: center; gap: 8px; padding: 7px 12px; border-right: 0; border-bottom: 1px solid var(--portal-line); }
  .portal-sidebar-collapse { display: none; }
  .portal-brand { flex: 0 0 auto; }
  .portal-brand small, .portal-history-heading, .portal-account-copy { display: none; }
  .portal-history-search { position: fixed; z-index: 84; top: 70px; left: 10px; width: calc(min(86vw, 360px) - 20px); visibility: hidden; transform: translateX(-110vw); transition: transform .2s ease, visibility .2s; }
  .portal-history-toggle { display: flex; margin-left: auto; }
  .portal-new-chat { width: auto; min-height: 36px; margin: 0; padding: 0 10px; }
  .portal-session-list {
    position: fixed;
    z-index: 82;
    top: 58px;
    bottom: 0;
    left: 0;
    width: min(86vw, 360px);
    display: grid;
    align-content: start;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 59px 10px calc(24px + env(safe-area-inset-bottom));
    border-right: 1px solid var(--portal-line);
    background: #0e0e10;
    box-shadow: 24px 0 70px rgba(0,0,0,.48);
    visibility: hidden;
    transform: translateX(-102%);
    transition: transform .2s ease, visibility .2s;
    overscroll-behavior: contain;
  }
  .portal-session-list .session-entry { width: 100%; flex: none; }
  .portal-session-list .session-item { padding-top: 11px; padding-bottom: 11px; }
  .portal-session-list .session-item-meta { display: block; }
  .portal-session-list .session-delete-button { opacity: 1; }
  .portal-session-scrim { position: fixed; z-index: 81; inset: 58px 0 0; display: block; padding: 0; border: 0; background: rgba(0,0,0,.58); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility .2s; }
  .portal-page.session-drawer-open .portal-session-list { visibility: visible; transform: translateX(0); }
  .portal-page.session-drawer-open .portal-history-search { visibility: visible; transform: translateX(0); }
  .portal-session-menu-toggle { opacity: 1; }
  .portal-page.session-drawer-open .portal-session-scrim { opacity: 1; visibility: visible; pointer-events: auto; }
  .portal-account { display: flex; gap: 4px; padding: 0; border: 0; }
  .portal-account #portal-account-toggle { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .portal-account-chevron { display: none; }
  .portal-chat-workspace { height: calc(100dvh - 58px); }
  .portal-chat-header { min-height: 58px; padding-left: 13px; padding-right: 13px; }
  .portal-composer-wrap { padding-left: 14px; padding-right: 14px; }
  .portal-page .chat-pet { bottom: calc(118px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .portal-brand > span:last-child { display: none; }
  .portal-history-toggle { width: 36px; justify-content: center; padding: 0; }
  .portal-history-toggle > span:last-child { display: none; }
  .portal-new-chat { width: 36px; justify-content: center; padding: 0; overflow: hidden; font-size: 0; }
  .portal-new-chat span { font-size: 18px; }
  .portal-account { margin-left: 0; }
  .portal-route-status, .portal-service-state { display: none; }
  .portal-chat-header .new-chat-button { display: flex; }
  .portal-chat-messages { padding-left: 8px; padding-right: 8px; }
  .portal-composer-wrap { padding-left: 8px; padding-right: 8px; }
  .portal-access-page { padding: 14px; }
  .portal-access-card { padding: 26px 20px; border-radius: 18px; }
  .portal-code-row { grid-template-columns: minmax(0, 1fr) 104px; }
  .portal-settings-shell { width: min(100% - 24px, 680px); padding-top: 36px; }
  .portal-settings-workspace { height: calc(100dvh - 58px); }
  .settings-embedded .portal-settings-shell { width: min(100% - 24px, 920px); }
  .portal-settings-card { padding: 19px; }
  .portal-settings-card-heading { display: grid; gap: 12px; }
  .portal-toggle { justify-self: start; }
  .chat-pet-gallery-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-account-details { grid-template-columns: 1fr; }
}
.portal-engineering-hint { color: var(--portal-muted); font-size: 10px; white-space: nowrap; }
/* Dictation controls: fixed-size target, no flashing indicator or layout jumps. */
.chat-microphone { flex: 0 0 40px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border, #45454a); border-radius: 50%; background: transparent; color: #939ba5; cursor: pointer; }
.chat-microphone[data-availability="available"] { color: #62d69a; border-color: rgba(98,214,154,.4); background: rgba(98,214,154,.08); }
.chat-microphone[aria-disabled="true"] { cursor: help; }
html[data-portal-theme="light"] .chat-microphone[data-availability="available"] { color: #137844; border-color: #8ebfa5; background: #eaf6ee; }
.chat-microphone[hidden], .speech-input-status[hidden] { display: none; }
.chat-microphone svg { width: 20px; height: 20px; }
.chat-microphone:hover, .chat-microphone:focus-visible { background: rgba(128,128,128,.18); outline: 2px solid currentColor; outline-offset: 2px; }
.chat-microphone.is-recording, html[data-portal-theme="light"] .chat-microphone.is-recording { color: #f87171; background: rgba(248,113,113,.1); border-color: currentColor; }
.chat-microphone:disabled { opacity: .5; cursor: wait; }
.speech-input-status { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: min(820px, 100%); padding: 8px 12px; margin: 0 auto 6px; border: 1px solid var(--border, #45454a); border-radius: 12px; font-size: 13px; color: inherit; background: rgba(128,128,128,.08); }
.portal-composer-wrap .speech-input-status { width: min(760px, 100%); }
.speech-input-status button { flex-shrink: 0; border: 0; background: transparent; color: inherit; padding: 6px 10px; cursor: pointer; text-decoration: underline; }
.speech-input-status[data-phase="recording"] { display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; gap: 12px; border-color: rgba(98,214,154,.35); }
.speech-input-status[data-phase="recording"] button { grid-column: -2 / -1; }
.speech-input-status [data-speech-label] { font-variant-numeric: tabular-nums; }
.speech-waveform { width: 100%; max-width: 320px; height: 36px; justify-self: center; color: #62d69a; }
.speech-waveform rect { fill: currentColor; }
.speech-waveform[hidden] { display: none; }
html[data-portal-theme="light"] .speech-waveform { color: #137844; }
.chat-history-load, .delivery-toggle { border: 1px solid var(--border, #45454a); border-radius: 12px; padding: 8px 12px; color: inherit; background: rgba(128,128,128,.08); cursor: pointer; }
.chat-history-load { display: block; margin: 8px auto 20px; }
.chat-virtual-history { width: 100%; overflow-anchor: none; }
.chat-virtual-turn { display: flow-root; }
.chat-virtual-turn .chat-message { animation: none; }
.chat-virtual-spacer { width: 100%; pointer-events: none; }
.modern-chat-messages .chat-history-row { animation: none; }
.delivery-workbench { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); border: 1px solid var(--border, #45454a); border-radius: 20px; background: #17171a; color: #eee; padding: 20px; overflow: auto; }
.delivery-workbench::backdrop { background: rgba(0,0,0,.55); }
.delivery-workbench header, .delivery-run-heading, .delivery-file { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.delivery-workbench h2 { margin: 0; font-size: 18px; }
.delivery-workbench button { background: transparent; color: inherit; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; }
.delivery-workbench button:hover, .delivery-workbench button:focus-visible { background: rgba(128,128,128,.16); }
.delivery-run { padding: 16px 0; border-bottom: 1px solid var(--border, #45454a); }
.delivery-run p { font-size: 12px; opacity: .75; overflow-wrap: anywhere; }
.delivery-file { padding: 8px; margin-top: 8px; border-radius: 12px; background: rgba(128,128,128,.08); }
.delivery-file > button:first-child { text-align: left; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.delivery-file a { color: inherit; font-size: 13px; white-space: nowrap; }
html[data-portal-theme="light"] .delivery-workbench { background: #fff; color: #202024; }
@media (max-width: 600px) { .delivery-toggle { font-size: 12px; padding: 7px 9px; } .delivery-workbench { padding: 14px; } }
@media (max-width: 600px) { .speech-input-status[data-phase="recording"] { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; } .speech-input-status[data-phase="recording"] [data-speech-label] { grid-column: 1; grid-row: 1; } .speech-input-status[data-phase="recording"] button { grid-column: 2; grid-row: 1; } .speech-waveform { grid-column: 1 / -1; grid-row: 2; max-width: none; } }

/* Management navigation is separate from the fixed account and language controls. */
html.management-console { --management-sidebar-width: 216px; scrollbar-gutter: stable; }
html.management-console[data-management-nav="collapsed"] { --management-sidebar-width: 72px; }
html.management-console body { padding-top: 76px; padding-left: var(--management-sidebar-width); }
.management-console body > main.page { width: calc(100% - 48px); max-width: 1480px; margin-inline: auto; padding-top: 36px; }
.topbar.management-header { position: fixed; inset: 0 0 auto; display: grid; grid-template-columns: 192px minmax(0, 1fr) max-content max-content 40px 112px; height: 76px; padding: 0 24px; gap: 16px; background: #0c1815; backdrop-filter: none; }
.management-header > .brand { grid-column: 1; grid-row: 1; margin: 0; min-width: 0; }
.management-header > .brand > span:last-child { min-width: 0; }
.management-header > .brand strong, .management-header > .brand small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.management-console .import-page-shell > label.import-boundary-note { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 10px; font-size: 11px; line-height: 1.6; }
.management-console .import-page-shell > label.import-boundary-note > input { width: 16px; height: 16px; margin: 1px 0 0; padding: 0; accent-color: var(--green); }
.management-header > .main-nav { position: fixed; inset: 76px auto 0 0; width: var(--management-sidebar-width); height: calc(100dvh - 76px); display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; padding: 20px 12px 16px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: #0c1815; box-shadow: none; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.management-header > .main-nav > a { flex: 0 0 auto; justify-content: flex-start; min-height: 46px; padding: 0 14px; gap: 12px; font-size: 13px; }
.management-header .main-nav-icon, .management-header .main-nav-icon svg { flex-shrink: 0; width: 18px; height: 18px; }
.management-nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.management-nav-collapse { display: flex; flex: 0 0 40px; align-items: center; gap: 12px; margin-top: auto; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); text-align: left; font-size: 12px; }
.management-nav-collapse svg { flex: 0 0 18px; width: 18px; height: 18px; }
.management-nav-collapse:hover { color: var(--text); background: rgba(119,229,181,.07); }
.management-nav-collapse:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
@media (min-width: 1181px) {
  html[data-management-nav="collapsed"] .management-header > .main-nav { padding-inline: 10px; }
  html[data-management-nav="collapsed"] .management-header > .main-nav > a, html[data-management-nav="collapsed"] .management-nav-collapse { justify-content: center; padding-inline: 0; gap: 0; }
  html[data-management-nav="collapsed"] .management-header .management-nav-label { display: none; }
  html[data-management-nav="collapsed"] .management-nav-collapse svg { transform: rotate(180deg); }
}
.management-header > .service-state { grid-column: 3; grid-row: 1; min-width: 0; max-width: 170px; justify-self: end; justify-content: flex-end; text-align: right; white-space: nowrap; }
.management-header > .service-state > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.management-header > .service-state .status-dot { flex: 0 0 8px; }
.management-header > .auth-account { grid-column: 4; grid-row: 1; justify-self: end; justify-content: flex-end; gap: 8px; padding-left: 16px; border-left: 1px solid var(--line); }
.management-header > .auth-account a, .management-header > .auth-account button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 8px; border-radius: 8px; font-size: 12px; }
.management-header > .auth-account a:hover, .management-header > .auth-account button:hover { background: var(--surface-strong); }
.management-header > .ui-language-switch { grid-column: 6; grid-row: 1; width: 100%; box-sizing: border-box; margin: 0; }
.management-theme-toggle { grid-column: 5; grid-row: 1; order: 80; width: 40px; height: 36px; flex: 0 0 40px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgba(255,255,255,.025); }
.management-theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.management-theme-toggle:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.management-theme-toggle svg { grid-area: 1 / 1; width: 18px; height: 18px; }
.management-theme-toggle .management-theme-moon { display: none; }
html[data-management-theme="light"] .management-theme-toggle .management-theme-sun { display: none; }
html[data-management-theme="light"] .management-theme-toggle .management-theme-moon { display: block; }
@media (max-width: 1180px) {
  html.management-console body { padding-top: 64px; padding-left: 0; }
  .management-console body > main.page { width: calc(100% - 28px); padding-top: 28px; }
  .topbar.management-header { display: flex; height: 64px; padding: 0 16px; gap: 10px; }
  .management-header > .brand { margin-right: auto; }
  .management-header > .main-nav { inset: 64px auto 0 0; width: min(320px, calc(100vw - 36px)); height: calc(100dvh - 64px); padding: 18px 16px max(18px, env(safe-area-inset-bottom)); border-right: 1px solid var(--line); border-radius: 0 18px 18px 0; background: #0c1815; box-shadow: 24px 0 60px rgba(0,0,0,.35); transform: translateX(-104%); }
  .management-header .management-nav-collapse { display: none; }
  .management-header > .main-nav > a { min-height: 48px; padding: 0 14px; font-size: 14px; }
  .management-header > .ui-language-switch { width: auto; }
  .management-theme-toggle { width: 36px; flex-basis: 36px; }
}
