:root {
  color-scheme: dark;
  --page: #0f0f12;
  --surface: #15161a;
  --surface-raised: #1b1c21;
  --surface-soft: #202126;
  --border: #2c2e35;
  --border-strong: #40424b;
  --text: #f3f4f7;
  --text-muted: #9a9da8;
  --primary: #7950e8;
  --primary-hover: #8964ed;
  --cyan: #00b8c9;
  --coral: #ee795f;
  --success: #24ad6b;
  --warning: #e4a83a;
  --danger: #e65e62;
  --focus: #a98cff;
  --radius-panel: 18px;
  --radius-control: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--text); color: var(--page); border-radius: 6px; }
.skip-link:focus { top: 16px; }
.boot-screen { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--text-muted); }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--primary); color: white; font-weight: 700; }

.app-shell { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 28px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(15,15,18,.93); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: max-content; font-weight: 680; }
.brand .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.topnav a { padding: 8px 12px; border-radius: 7px; color: var(--text-muted); font-size: 14px; white-space: nowrap; transition: background .2s ease, color .2s ease; }
.topnav a:hover, .topnav a.active { color: var(--text); background: var(--surface-soft); }
.account-menu { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 13px; }
.icon-button { width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .12s ease; }
.icon-button:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.icon-button:active { transform: scale(.97); }
.icon-button img, .button img, .inline-icon { width: 17px; height: 17px; filter: invert(1); opacity: .9; }

.page { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: 12px; font-weight: 650; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 32px; line-height: 1.2; font-weight: 720; letter-spacing: 0; }
h2 { font-size: 19px; line-height: 1.3; font-weight: 660; letter-spacing: 0; }
h3 { font-size: 15px; line-height: 1.4; font-weight: 640; }
.page-description { max-width: 680px; margin-bottom: 0; color: var(--text-muted); line-height: 1.75; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-control); padding: 9px 15px; background: var(--surface-soft); color: var(--text); font-weight: 620; font-size: 14px; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .12s ease, opacity .2s ease; }
.button:hover { background: #292a31; border-color: var(--border-strong); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-hover); border-color: transparent; }
.button.danger { background: rgba(230,94,98,.12); border-color: rgba(230,94,98,.38); color: #ffb9bb; }
.button.quiet { background: transparent; border-color: var(--border); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.portal { padding-top: 42px; }
.portal-intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 40px; align-items: end; margin-bottom: 28px; }
.portal-intro h1 { max-width: 760px; font-size: 38px; }
.portal-meta { min-width: 210px; padding-left: 20px; border-left: 2px solid var(--coral); color: var(--text-muted); line-height: 1.8; font-size: 13px; }
.portal-grid { display: grid; grid-template-columns: 1.12fr .88fr; grid-template-rows: minmax(420px, 58vh); gap: 18px; }
.portal-card { position: relative; min-width: 0; overflow: hidden; border-radius: var(--radius-panel); background: var(--surface); isolation: isolate; }
.portal-card img.portal-media { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .55s cubic-bezier(.2,.7,.2,1); }
.portal-card:hover img.portal-media { transform: scale(1.035); }
.portal-card::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(8,8,10,.02) 20%, rgba(8,8,10,.88) 100%); }
.portal-card-content { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 30px; }
.portal-card-content .card-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 10px; background: rgba(15,15,18,.76); backdrop-filter: blur(12px); }
.portal-card-content .card-icon img { width: 21px; filter: invert(1); }
.portal-card h2 { margin-bottom: 8px; font-size: 27px; }
.portal-card p { max-width: 480px; margin-bottom: 20px; color: rgba(255,255,255,.75); line-height: 1.65; }

.login-layout { min-height: 100dvh; display: grid; grid-template-columns: minmax(360px, 42%) 1fr; }
.login-panel { display: flex; flex-direction: column; padding: 34px clamp(28px, 5vw, 78px); background: var(--surface); border-right: 1px solid var(--border); }
.login-panel .brand { margin-bottom: 10vh; }
.login-box { width: min(440px, 100%); margin: auto 0; }
.login-box h1 { font-size: 31px; }
.login-box > p { color: var(--text-muted); line-height: 1.7; }
.method-tabs { display: flex; gap: 6px; margin: 26px 0 20px; padding-bottom: 6px; overflow-x: auto; }
.method-tab { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 7px; padding: 8px 12px; background: transparent; color: var(--text-muted); cursor: pointer; }
.method-tab.active { background: var(--surface-soft); color: var(--text); border-color: var(--primary); }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { color: #c8cad1; font-size: 13px; font-weight: 600; }
.field input, .field textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--page); color: var(--text); padding: 11px 12px; line-height: 1.5; }
.field textarea { min-height: 132px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--primary); outline: 2px solid rgba(121,80,232,.22); }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.login-error { min-height: 22px; color: #ff9fa3; font-size: 13px; }
.login-submit { width: 100%; margin-top: 8px; }
.login-secondary-action { width: 100%; margin-top: 10px; }
.auth-switch { margin-top: 20px; text-align: center; font-size: 13px; }
.auth-switch a { color: #b9a5ff; font-weight: 650; }
.login-visual { position: relative; overflow: hidden; background: #cfd1d3; }
.login-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-visual::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,15,18,.05), rgba(15,15,18,.68)); }
.login-caption { position: absolute; z-index: 1; left: 48px; right: 48px; bottom: 44px; max-width: 540px; }
.login-caption h2 { margin-bottom: 10px; font-size: 30px; }
.login-caption p { color: rgba(255,255,255,.75); line-height: 1.7; }

.notice { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.notice strong { flex: 0 0 auto; }
.notice span { color: var(--text-muted); line-height: 1.5; }
.notice.warning { border-color: rgba(228,168,58,.5); background: rgba(228,168,58,.09); }
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; }
.settings-section { min-width: 0; padding-top: 22px; border-top: 1px solid var(--border); }
.settings-heading { margin-bottom: 22px; }
.settings-heading h2 { margin-bottom: 0; font-size: 21px; }
.settings-form { max-width: 520px; }
.settings-form .button { min-width: 132px; }
.form-message { min-height: 22px; margin: 12px 0 0; color: var(--text-muted); font-size: 13px; }

.user-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(110px, .55fr) minmax(145px, .7fr) minmax(155px, .75fr) auto; align-items: center; gap: 14px; min-height: 74px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.user-primary { min-width: 0; display: grid; gap: 5px; }
.user-primary strong, .user-primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-primary span, .user-cell small { color: var(--text-muted); font-size: 12px; }
.user-cell { display: grid; gap: 5px; font-size: 13px; }
.user-actions { display: flex; gap: 7px; }
.temporary-password-dialog { width: min(460px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); }
.temporary-password-dialog::backdrop { background: rgba(7,7,9,.78); }
.temporary-password-dialog h2 { font-size: 21px; }
.temporary-password-dialog p { color: var(--text-muted); line-height: 1.6; }
.temporary-password { display: block; margin: 20px 0; padding: 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--page); color: #d8cdff; font: 650 18px/1.4 ui-monospace, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

.workspace-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.workspace-main { display: grid; gap: 18px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--surface); padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-head h2, .panel-head h3 { margin-bottom: 4px; }
.panel-head p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.upload-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.upload-zone { min-height: 150px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--page); color: var(--text-muted); text-align: center; cursor: pointer; transition: background .2s ease, border-color .2s ease; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--cyan); background: rgba(0,184,201,.06); }
.upload-zone img { width: 22px; filter: invert(1); opacity: .7; }
.upload-zone strong { color: var(--text); font-size: 13px; }
.upload-zone span { font-size: 12px; }
.file-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 62px; height: 62px; overflow: hidden; border-radius: 8px; border: 1px solid var(--border); background: var(--page); }
.thumb > img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; right: 2px; top: 2px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: rgba(8,8,10,.78); cursor: pointer; }
.thumb button img { width: 12px; filter: invert(1); }
.workspace-sidebar { position: sticky; top: 82px; display: grid; gap: 14px; }
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scope-grid .button:last-child { grid-column: 1 / -1; }
.task-status { display: grid; gap: 12px; }
.status-row { display: flex; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 13px; }
.status-row strong { color: var(--text); text-align: right; }
.progress { height: 7px; overflow: hidden; border-radius: 7px; background: var(--page); }
.progress > div { width: 0; height: 100%; border-radius: inherit; background: var(--primary); transition: width .35s ease; }
.sidebar-note { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.65; }

.results-section { margin-top: 28px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.result-grid.details { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.result-card { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.result-image { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; background: var(--page); cursor: zoom-in; }
.details .result-image { aspect-ratio: 4 / 5; object-fit: contain; }
.result-meta { display: flex; align-items: center; gap: 8px; padding: 10px 11px; }
.result-meta strong { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.result-actions { display: flex; gap: 4px; }
.result-actions .icon-button { width: 32px; height: 32px; flex-basis: 32px; }
.result-actions img { width: 15px; }
.empty-state { min-height: 210px; display: grid; place-content: center; justify-items: center; gap: 10px; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted); text-align: center; }
.result-grid > .empty-state { grid-column: 1 / -1; }
.empty-state img { width: 28px; filter: invert(1); opacity: .45; }

.history-list { display: grid; gap: 10px; }
.history-row { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(120px, .6fr) minmax(120px, .6fr) minmax(160px, .8fr) auto; gap: 14px; align-items: center; min-height: 76px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.history-row.admin { grid-template-columns: minmax(220px, 1.35fr) minmax(120px, .65fr) minmax(90px, .45fr) minmax(155px, .75fr) minmax(110px, .5fr) auto; }
.history-actions { display: flex; gap: 4px; justify-content: flex-end; }
.history-main { min-width: 0; }
.history-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-main span, .history-cell small { color: var(--text-muted); font-size: 12px; }
.history-cell { font-size: 13px; }
.status-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border-radius: 6px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }
.status-badge.completed { background: rgba(36,173,107,.12); color: #77d9a6; }
.status-badge.partial { background: rgba(228,168,58,.13); color: #f1c66d; }
.status-badge.running, .status-badge.queued { background: rgba(0,184,201,.12); color: #70dbe4; }
.status-badge.failed, .status-badge.stopped { background: rgba(230,94,98,.12); color: #ff9fa3; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; color: var(--text-muted); font-size: 13px; }

.detail-drawer { position: fixed; inset: 0; z-index: 60; display: none; justify-content: flex-end; background: rgba(5,5,7,.7); backdrop-filter: blur(6px); }
.detail-drawer.open { display: flex; }
.drawer-panel { width: min(840px, 94vw); height: 100%; overflow-y: auto; background: var(--page); border-left: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow); }
.drawer-head { position: sticky; top: -24px; z-index: 2; display: flex; align-items: center; gap: 12px; margin: -24px -24px 22px; padding: 18px 24px; background: rgba(15,15,18,.96); border-bottom: 1px solid var(--border); }
.drawer-head h2 { flex: 1; margin: 0; }
.asset-group { margin-bottom: 28px; }
.asset-group h3 { color: var(--text-muted); }
.failed-tasks { display: grid; gap: 8px; padding: 12px; border: 1px solid rgba(228,168,58,.35); border-radius: 8px; background: rgba(228,168,58,.07); }
.failed-tasks[hidden] { display: none; }
.failed-tasks > strong, .failed-summary h3 { color: #f1c66d; font-size: 13px; }
.failed-tasks ul, .failed-summary ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.failed-tasks li, .failed-summary li { display: grid; gap: 2px; }
.failed-tasks li strong, .failed-summary li strong { font-size: 13px; }
.failed-tasks li span, .failed-summary li span { color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.failed-summary { margin: 18px 0 24px; padding: 14px 16px; border: 1px solid rgba(228,168,58,.35); border-radius: 8px; background: rgba(228,168,58,.07); }
.failed-summary h3 { margin-bottom: 9px; }
.failed-result { display: grid; min-height: 250px; border-color: rgba(228,168,58,.35); background: rgba(228,168,58,.05); }
.result-failure { display: grid; place-content: center; justify-items: center; gap: 7px; min-height: 100%; padding: 18px; color: var(--text-muted); text-align: center; }
.result-failure > img { width: 24px; filter: invert(82%) sepia(67%) saturate(504%) hue-rotate(349deg); }
.result-failure strong { color: #f1c66d; }
.result-failure span, .result-failure small { max-width: 24ch; line-height: 1.45; }

.preview { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 26px 82px; background: rgba(5,5,7,.94); }
.preview.open { display: flex; }
.preview figure { margin: 0; display: grid; justify-items: center; gap: 10px; max-width: 100%; max-height: 100%; }
.preview figure > img { max-width: 100%; max-height: calc(100vh - 96px); object-fit: contain; border-radius: 8px; }
.preview figcaption { color: var(--text-muted); font-size: 13px; }
.preview-close { position: absolute; right: 22px; top: 22px; }
.preview-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.preview-prev { left: 22px; }
.preview-next { right: 22px; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast { width: min(360px, calc(100vw - 40px)); padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow); animation: toast-in .24s ease both; }
.toast.error { border-color: rgba(230,94,98,.55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .portal-grid { grid-template-columns: 1fr; grid-template-rows: repeat(2, minmax(330px, 48vh)); }
  .workspace-layout { grid-template-columns: 1fr; }
  .workspace-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .login-layout { grid-template-columns: 1fr; }
  .login-panel { min-height: 100dvh; border-right: 0; }
  .login-visual { display: none; }
  .history-row { grid-template-columns: 1fr 1fr auto; }
  .history-row .history-cell:nth-child(3) { display: none; }
  .settings-layout { grid-template-columns: 1fr; gap: 34px; }
  .user-row { grid-template-columns: minmax(160px, 1fr) minmax(120px, .6fr) auto; }
  .user-row .user-cell:nth-child(4) { display: none; }
}

@media (max-width: 700px) {
  .topbar { height: auto; min-height: 60px; padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .topnav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .topnav a { flex: 0 0 auto; }
  .account-name { display: none; }
  .page { width: min(100% - 28px, 1440px); padding-top: 22px; }
  .page-head, .portal-intro { display: block; }
  .head-actions { justify-content: flex-start; margin-top: 18px; }
  h1, .portal-intro h1 { font-size: 28px; }
  .portal-meta { margin-top: 18px; }
  .portal-grid { grid-template-rows: repeat(2, 340px); }
  .portal-card-content { padding: 20px; }
  .upload-grid, .workspace-sidebar { grid-template-columns: 1fr; }
  .scope-grid .button:last-child { grid-column: auto; }
  .history-row { grid-template-columns: minmax(0, 1fr) auto; }
  .history-row.admin { grid-template-columns: minmax(0, 1fr) auto; }
  .history-row .history-cell { display: none; }
  .notice { align-items: flex-start; flex-direction: column; }
  .user-row { grid-template-columns: minmax(0, 1fr) auto; }
  .user-row .user-cell { display: none; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .preview { padding: 70px 12px 24px; }
  .preview-nav { top: auto; bottom: 18px; transform: none; }
  .preview-prev { left: calc(50% - 48px); }
  .preview-next { right: calc(50% - 48px); }
}

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

/* Conversational AI Picture workspace */
.agent-page {
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  min-height: 0;
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  overflow: hidden;
  background: #101114;
}
.agent-sidebar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: #141519;
  padding: 14px 12px;
}
.agent-sidebar-head { display: flex; gap: 8px; align-items: center; }
.agent-sidebar-head .button { min-width: 0; flex: 1; }
.agent-sidebar-close { display: none; }
.conversation-search { margin: 12px 0 8px; }
.conversation-search input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 11px;
  background: #0f1013;
  color: var(--text);
}
.conversation-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; display: grid; align-content: start; gap: 3px; }
.conversation-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px 30px;
  align-items: center;
  border-radius: 7px;
}
.conversation-row.active { background: #25272d; }
.conversation-row > button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.conversation-row > button:first-child {
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  text-align: left;
}
.conversation-row > button:first-child img { width: 16px; flex: 0 0 16px; filter: invert(1); opacity: .55; }
.conversation-row > button:first-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row-action { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border-radius: 6px !important; opacity: 0; }
.conversation-row:hover .conversation-row-action, .conversation-row:focus-within .conversation-row-action { opacity: 1; }
.conversation-row-action:hover { background: #30323a; }
.conversation-row-action.danger:hover { background: rgba(230,94,98,.16); }
.conversation-row-action img { width: 14px; filter: invert(1); }
.conversation-list-empty { padding: 18px 10px; color: var(--text-muted); font-size: 13px; text-align: center; }
.classic-workspace-link {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 0 10px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.classic-workspace-link img { width: 17px; filter: invert(1); opacity: .65; }
.classic-workspace-link:hover { color: var(--text); }
.agent-workspace { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-rows: 58px minmax(0, 1fr); overflow: hidden; }
.agent-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(16,17,20,.96);
}
.agent-toolbar > div:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.agent-toolbar > div:nth-child(2) span { color: var(--text-muted); font-size: 11px; }
.agent-toolbar > div:nth-child(2) strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.agent-sidebar-open { display: none; }
.agent-toolbar-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 7px; }
.skill-selector {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid #343740;
  border-radius: 8px;
  background: #141519;
}
.skill-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  padding: 5px 9px;
  background: transparent;
  color: #c6c9d0;
  cursor: pointer;
  white-space: nowrap;
}
.skill-toggle:hover { background: #202228; }
.skill-toggle.active { background: rgba(36,173,107,.15); color: #8be0b5; }
.skill-toggle.xhs.active { background: rgba(238,121,95,.16); color: #ffad9c; }
.skill-toggle img { width: 16px; filter: invert(1); }
.agent-messages { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px clamp(18px, 4vw, 52px) 18px; }
.agent-empty { min-height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; }
.agent-empty-mark { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 14px; border: 1px solid #3d4149; border-radius: 8px; background: #1b1d22; }
.agent-empty-mark img { width: 22px; filter: invert(1); }
.agent-empty h1 { margin-bottom: 7px; font-size: 25px; }
.agent-empty p { margin: 0; color: var(--text-muted); }
.message-stack { width: min(900px, 100%); margin: 0 auto; padding-bottom: max(190px, min(300px, 34vh)); display: grid; gap: 24px; }
.chat-message { min-width: 0; }
.chat-message.user { max-width: min(720px, 88%); justify-self: end; padding: 13px 15px; border-radius: 8px; background: #252830; }
.chat-message.assistant { width: 100%; padding-left: 38px; position: relative; }
.chat-message.assistant::before {
  content: "AI";
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #1f6149;
  color: white;
  font-size: 10px;
  font-weight: 700;
}
.chat-message.failed { color: #ffb2b5; }
.message-author { margin-bottom: 6px; color: var(--text-muted); font-size: 11px; font-weight: 650; }
.chat-message p { margin: 0; line-height: 1.72; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-message small { display: block; margin-top: 7px; color: var(--text-muted); }
.message-reference-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 0 0 10px; }
.message-reference { width: auto; height: auto; max-width: min(280px, 100%); max-height: 240px; flex: 0 1 auto; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid #454953; border-radius: 7px; padding: 0; background: #14161a; cursor: zoom-in; }
.message-reference img { width: auto; height: auto; max-width: 100%; max-height: 240px; display: block; object-fit: contain; }
.streaming p i { display: inline-block; width: 7px; height: 16px; margin-left: 3px; background: #8be0b5; vertical-align: -2px; animation: cursor-blink .8s steps(1) infinite; }
@keyframes cursor-blink { 50% { opacity: 0; } }
.agent-composer-wrap { position: fixed; z-index: 5; left: 276px; right: 0; bottom: 0; padding: 10px clamp(16px, 4vw, 48px) 18px; background: linear-gradient(180deg, rgba(16,17,20,0), #101114 18%); }
.agent-composer {
  width: min(900px, 100%);
  min-width: 0;
  margin: 0 auto;
  border: 1px solid #3a3d45;
  border-radius: 8px;
  background: #191b20;
  box-shadow: 0 16px 38px rgba(0,0,0,.24);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.agent-drop-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; visibility: hidden; opacity: 0; background: rgba(10,12,14,.72); transition: opacity .16s ease, visibility .16s ease; }
.agent-drop-overlay.active { visibility: visible; opacity: 1; }
.agent-drop-overlay span { width: 76px; height: 76px; display: grid; place-items: center; border: 1px solid #4ba77f; border-radius: 8px; background: #19251f; box-shadow: 0 0 0 8px rgba(75,167,127,.12); }
.agent-drop-overlay span img { width: 34px; height: 34px; filter: invert(78%) sepia(18%) saturate(987%) hue-rotate(101deg) brightness(86%); }
.agent-composer textarea {
  width: 100%;
  min-height: 68px;
  max-height: 180px;
  display: block;
  resize: vertical;
  border: 0;
  outline: 0;
  padding: 14px 15px 7px;
  background: transparent;
  color: var(--text);
  line-height: 1.55;
}
.composer-controls { height: 48px; display: flex; align-items: center; gap: 8px; padding: 5px 8px; }
.composer-controls .icon-button { width: 34px; height: 34px; flex-basis: 34px; }
.composer-controls label input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.reference-limit { color: var(--text-muted); font-size: 12px; }
.image-model-select { min-width: 0; height: 32px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 0 7px; background: #15171b; color: var(--text-muted); font-size: 11px; }
.image-model-select select { min-width: 82px; max-width: 142px; height: 28px; border: 0; outline: 0; background: #15171b; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.panel-head .image-model-select { flex: 0 0 auto; }
.output-stepper { height: 32px; margin-left: auto; display: grid; grid-template-columns: 30px 50px 30px; align-items: center; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.output-stepper button { height: 100%; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 16px; }
.output-stepper button:hover { background: #292c33; }
.output-stepper output { text-align: center; color: var(--text-muted); font-size: 12px; }
.composer-send { background: #2d7c5d !important; border-color: #3e9674 !important; }
.composer-send:hover { background: #368d6a !important; }
.selected-assets { display: flex; gap: 7px; overflow-x: auto; padding: 0 9px; }
.selected-assets:not(:empty) { padding-top: 9px; }
.agent-reference-thumb { position: relative; width: 54px; height: 54px; flex: 0 0 54px; overflow: hidden; border: 1px solid var(--border); border-radius: 7px; background: #101114; }
.agent-reference-preview { width: 100%; height: 100%; display: block; border: 0; padding: 0; background: transparent; cursor: zoom-in; }
.agent-reference-preview > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.agent-reference-remove { position: absolute; right: 2px; top: 2px; width: 18px; height: 18px; display: grid; place-items: center; border: 0; border-radius: 4px; padding: 0; background: rgba(0,0,0,.76); cursor: pointer; }
.agent-reference-remove img { width: 10px; filter: invert(1); }
.agent-job-progress { margin: 14px 0; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.agent-job-progress > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--text-muted); font-size: 12px; }
.agent-job-progress strong { color: var(--text); }
.agent-output-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.agent-output { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: #15161a; }
.agent-output > img { width: auto; height: auto; max-width: 100%; max-height: min(560px, 64vh); display: block; margin: 0 auto; object-fit: contain; cursor: zoom-in; }
.agent-output > div { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 5px 7px 5px 10px; }
.agent-output > div span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.agent-output .icon-button { width: 30px; height: 30px; flex-basis: 30px; }
.message-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.message-actions .button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.agent-job-error { margin-top: 10px; color: #f0bd60; font-size: 12px; }
.skill-flow { overflow: hidden; border: 1px solid #3a3e45; border-radius: 8px; background: #181a1f; }
.skill-flow > header { display: flex; justify-content: space-between; gap: 16px; padding: 16px 17px 11px; }
.skill-flow > header span { color: #75d5a3; font-size: 11px; }
.skill-flow > header h2 { margin: 3px 0 0; font-size: 17px; }
.skill-flow > header > strong { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.skill-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 0 17px 15px; }
.skill-steps i { height: 3px; border-radius: 3px; background: #343740; }
.skill-steps i.active { background: #31a574; }
.skill-step-body { min-height: 196px; padding: 17px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.skill-step-body .field { margin: 0; }
.skill-step-body textarea { background: #111215; }
.skill-flow > footer { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 9px 14px; }
.skill-flow .button.primary { background: #267e5c; }
.skill-upload { min-height: 142px; display: grid; place-content: center; justify-items: center; gap: 7px; border: 1px dashed #4a4e57; border-radius: 8px; background: #111215; color: var(--text-muted); cursor: pointer; }
.skill-upload:hover { border-color: #53b58a; }
.skill-upload > span:first-child { color: var(--text); font-size: 13px; }
.skill-upload > strong { font-size: 12px; }
.skill-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.skill-upload-thumbs { display: flex; gap: 4px; justify-content: center; }
.skill-upload-thumbs > img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; filter: none; }
.skill-upload-thumbs > img[src$="upload.svg"] { width: 22px; filter: invert(1); opacity: .6; }
.skill-reference-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.skill-scope { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.skill-scope button { min-height: 52px; border: 1px solid var(--border); border-radius: 7px; background: #111215; color: var(--text-muted); cursor: pointer; }
.skill-scope button.active { border-color: #49a77f; background: rgba(36,173,107,.1); color: #8be0b5; }
.skill-summary { margin: 0; display: grid; gap: 10px; }
.skill-summary > div { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.skill-summary dt { color: var(--text-muted); }
.skill-summary dd { margin: 0; overflow-wrap: anywhere; }
.skill-card-closed { padding: 14px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-muted); }
.xhs-skill-flow > header span { color: #ff9d89; }
.xhs-skill-flow .skill-steps { grid-template-columns: repeat(3, 1fr); }
.xhs-skill-flow .skill-steps i.active { background: var(--coral); }
.xhs-skill-flow .button.primary { background: #b95340; }
.xhs-skill-flow .button.primary:hover { background: #c6604c; }
.xhs-step-stack { display: grid; gap: 18px; }
.xhs-field-group { min-width: 0; display: grid; gap: 8px; }
.xhs-field-group > span { color: var(--text-muted); font-size: 12px; font-weight: 650; }
.xhs-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 7px; }
.xhs-choice-grid button {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  background: #111215;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}
.xhs-choice-grid button:hover { border-color: #5a4a48; background: #1b1818; }
.xhs-choice-grid button.active { border-color: rgba(238,121,95,.62); background: rgba(238,121,95,.09); color: var(--text); }
.xhs-choice-grid button strong { font-size: 13px; }
.xhs-choice-grid button span { min-width: 0; overflow-wrap: anywhere; font-size: 11px; }
.xhs-brief-grid, .xhs-evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.xhs-brief-grid .field, .xhs-evidence-grid .field { min-width: 0; }
.xhs-brief-grid input, .xhs-evidence-grid input { width: 100%; }
.xhs-brief-grid textarea { min-height: 96px; }
.xhs-evidence-grid textarea { min-height: 92px; }
.xhs-wide { grid-column: 1 / -1; }
.xhs-evidence-head { display: grid; gap: 4px; margin-bottom: 14px; padding-left: 11px; border-left: 3px solid #4c9e79; }
.xhs-evidence-head.conversion { border-left-color: var(--coral); }
.xhs-evidence-head strong { font-size: 13px; }
.xhs-evidence-head span { color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.xhs-job-message > p { color: var(--text-muted); }
.xhs-fact-audit { display: grid; gap: 7px; margin: 14px 0 18px; padding: 11px 13px; border-left: 3px solid var(--success); background: rgba(36,173,107,.06); }
.xhs-fact-audit.limited { border-left-color: var(--warning); background: rgba(228,168,58,.06); }
.xhs-fact-audit > div { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.xhs-fact-audit strong { color: #9ee3bf; font-size: 13px; }
.xhs-fact-audit.limited strong { color: #f1c66d; }
.xhs-fact-audit span, .xhs-fact-audit p { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.xhs-deliverable { min-width: 0; }
.xhs-batch-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.xhs-batch-head > span { color: #ffb09f; font-size: 12px; font-weight: 650; }
.xhs-batch-list { display: grid; gap: 16px; }
.xhs-batch-note { padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: #15161a; }
.xhs-batch-note .xhs-page-card { background: #101114; }
.xhs-deliverable > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.xhs-deliverable > header > div { min-width: 0; }
.xhs-deliverable > header span { color: #ff9d89; font-size: 11px; }
.xhs-deliverable > header h2 { margin: 4px 0 0; overflow-wrap: anywhere; font-size: 20px; line-height: 1.45; }
.xhs-deliverable > header .button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; font-size: 12px; }
.xhs-caption { margin: 14px 0 18px !important; color: #dfe1e6; }
.xhs-result-cta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 18px; padding: 10px 12px; border-left: 3px solid var(--coral); background: rgba(238,121,95,.07); }
.xhs-result-cta strong { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.xhs-result-cta span { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; }
.xhs-page-list { display: grid; gap: 12px; }
.xhs-page-card { min-width: 0; display: grid; grid-template-columns: minmax(176px, 230px) minmax(0, 1fr); gap: 16px; align-items: stretch; padding: 11px; border: 1px solid var(--border); border-radius: 8px; background: #15161a; }
.xhs-page-visual { width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 6px; background: #0f1013; }
.xhs-page-visual img { width: 100%; height: 100%; display: block; object-fit: cover; cursor: zoom-in; }
.xhs-page-placeholder { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; color: var(--text-muted); text-align: center; font-size: 12px; }
.xhs-page-copy { min-width: 0; align-self: center; }
.xhs-page-copy > span { color: #ff9d89; font-size: 11px; }
.xhs-page-copy h3 { margin: 6px 0; overflow-wrap: anywhere; font-size: 17px; line-height: 1.45; }
.xhs-page-copy p { color: var(--text-muted); font-size: 13px; }
.xhs-page-copy ul { margin: 10px 0 0; padding-left: 18px; color: #d9dbe1; line-height: 1.65; font-size: 13px; }
.xhs-page-copy li + li { margin-top: 4px; }
.xhs-hashtags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.xhs-hashtags span { padding: 4px 7px; border: 1px solid #3c3f47; border-radius: 5px; color: #b9bdc7; font-size: 11px; }
.admin-history-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.admin-history-tabs button { min-height: 42px; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; background: transparent; color: var(--text-muted); cursor: pointer; }
.admin-history-tabs button.active { border-bottom-color: var(--cyan); color: var(--text); }
[data-admin-conversations-panel][hidden], [data-admin-jobs-panel][hidden] { display: none; }
.admin-conversation-search { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.admin-conversation-search input { width: min(380px, 100%); height: 40px; border: 1px solid var(--border); border-radius: 7px; padding: 0 12px; background: var(--surface); color: var(--text); }
.admin-conversation-list { display: grid; gap: 8px; }
.admin-conversation-row { min-width: 0; min-height: 72px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(130px, .45fr) minmax(180px, .55fr) auto; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.admin-conversation-row > div { min-width: 0; display: grid; gap: 4px; }
.admin-conversation-row strong, .admin-conversation-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-conversation-row small, .admin-conversation-row > div:first-child span { color: var(--text-muted); font-size: 12px; }
.admin-conversation-row .history-actions { display: flex; }
.admin-conversation-transcript { display: grid; gap: 14px; margin-bottom: 28px; }
.admin-conversation-transcript > article { padding: 12px 0; border-bottom: 1px solid var(--border); }
.admin-conversation-transcript p { margin: 6px 0; line-height: 1.65; white-space: pre-wrap; }
.admin-conversation-transcript small { color: var(--text-muted); }

@media (max-width: 800px) {
  .agent-page { height: calc(100vh - 112px); height: calc(100dvh - 112px); grid-template-columns: minmax(0, 1fr); }
  .agent-sidebar {
    position: fixed;
    z-index: 55;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(310px, 88vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 18px 0 40px rgba(0,0,0,.36);
  }
  .agent-sidebar.open { transform: translateX(0); }
  .agent-sidebar-close, .agent-sidebar-open { display: inline-grid; }
  .agent-toolbar { padding: 0 10px; }
  .agent-toolbar-actions { gap: 5px; }
  .skill-selector { max-width: 286px; }
  .skill-toggle { min-width: 0; }
  .skill-toggle span { overflow: hidden; text-overflow: ellipsis; }
  .agent-messages { padding: 18px 12px 12px; }
  .agent-composer-wrap { left: 0; padding: 8px 10px 10px; }
  .chat-message.user { max-width: 94%; }
  .chat-message.assistant { padding-left: 35px; }
  .message-reference { max-width: min(220px, 100%); max-height: 200px; flex-basis: auto; }
  .message-reference img { max-height: 200px; }
  .agent-output > img { max-height: min(480px, 58vh); }
  .agent-output-grid { grid-template-columns: 1fr; }
  .skill-reference-grid { grid-template-columns: 1fr; }
  .skill-upload { min-height: 104px; }
  .xhs-page-card { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); }
  .xhs-batch-head { align-items: flex-start; }
  .admin-conversation-row { grid-template-columns: minmax(0, 1fr) auto; }
  .admin-conversation-row > div:nth-child(2), .admin-conversation-row > div:nth-child(3) { display: none; }
}

@media (max-width: 520px) {
  .agent-page { height: calc(100vh - 150px); height: calc(100dvh - 150px); }
  .agent-toolbar { height: 58px; }
  .agent-toolbar > div:nth-child(2) { display: none; }
  .agent-toolbar-actions { width: calc(100% - 50px); }
  .skill-selector { min-width: 0; max-width: none; flex: 1 1 auto; margin-left: auto; }
  .skill-toggle { min-width: 0; flex: 1 1 0; justify-content: center; padding-right: 6px; padding-left: 6px; font-size: 12px; }
  .skill-toggle img { width: 14px; }
  .agent-toolbar-actions .icon-button { width: 34px; height: 34px; flex-basis: 34px; }
  .composer-controls { gap: 6px; }
  .reference-limit { font-size: 11px; }
  .composer-controls .image-model-select { padding: 0 5px; }
  .composer-controls .image-model-select > span { display: none; }
  .composer-controls .image-model-select select { min-width: 72px; max-width: 116px; }
  .output-stepper { grid-template-columns: 26px 44px 26px; }
  .skill-flow > header { padding: 14px 13px 10px; }
  .skill-steps { padding-right: 13px; padding-left: 13px; }
  .skill-step-body { min-height: 176px; padding: 13px; }
  .xhs-brief-grid, .xhs-evidence-grid { grid-template-columns: 1fr; }
  .xhs-wide { grid-column: auto; }
  .xhs-choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xhs-page-card { grid-template-columns: 1fr; }
  .xhs-batch-head { flex-wrap: wrap; }
  .xhs-page-visual { width: min(100%, 300px); margin: 0 auto; }
  .xhs-deliverable > header { align-items: flex-start; }
}

/* Keep the conversational workspace inside the viewport; its inner panes own scrolling. */
html:has(.agent-page), body:has(.agent-page), #app:has(.agent-page) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.app-shell:has(.agent-page) {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.app-shell:has(.agent-page) > .agent-page {
  height: auto;
  min-height: 0;
}
