main.workspace{display:block;max-width:1160px;margin:32px auto;padding:0 24px}
h1{font-size:clamp(2rem,4vw,3rem)}
#workspace{display:grid;grid-template-columns:minmax(240px,.8fr) minmax(0,1.2fr);gap:24px}
#workspace section{min-width:0;border:2px solid #89cbd0;background:#0d2a42;padding:24px}
#workspace form,#workspace label{display:grid;gap:8px}
#workspace input,#workspace select,#workspace textarea{width:100%;min-width:0;padding:12px;border:2px solid #89cbd0;background:#071b2b;color:#f4eddd;font:inherit}
#workspace textarea{min-height:140px;resize:vertical}
#workspace button{border:2px solid #ffd04a;background:#ffd04a;color:#071b2b;padding:12px;font:inherit;cursor:pointer}
#workspace button:disabled{opacity:.5}
#messages{white-space:pre-wrap;overflow-wrap:anywhere;max-height:55vh;overflow:auto}
#messages article{border-bottom:2px solid #89cbd0;padding:16px 0}
#connections{list-style:none;padding:0}
#connections li{border-bottom:2px solid #89cbd0;padding:12px 0;overflow-wrap:anywhere}
.skip-link{position:absolute;left:-9999px}
.skip-link:focus{left:16px;top:16px}
#workspace,#messages,#connections{overflow-x:hidden}
@media(max-width:760px){#workspace{grid-template-columns:1fr;padding:16px}#workspace section{padding:16px}header{flex-wrap:wrap}}#roundtableSection{grid-column:1/-1}#roundtableSeats label{display:flex;align-items:center;gap:12px}#roundtableSeats input{width:auto}

details#accessDiagnostics{margin:16px 0;}textarea#accessDiagnosticText{width:100%;box-sizing:border-box;background:#071b2b;color:#f4eddd;border:2px solid #89cbd0;padding:12px;font:inherit;}
#latestReplyText {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#currentAiAccount{overflow-wrap:anywhere;}
#conversationNoteDialog {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  box-sizing: border-box;
  padding: 1.25rem;
  background: #0d2a3f;
  color: #f4ecd8;
  border: 1px solid #8ccbd1;
}
#conversationNoteText {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 12rem;
  background: #071b2b;
  color: inherit;
  border: 1px solid #8ccbd1;
  padding: .75rem;
  font: inherit;
}

#conversationNoteDialog::backdrop {background:rgba(0,0,0,.65);}
#conversationNoteDialog label {display:block;}


#bridgeJobResult pre{white-space:pre-wrap;overflow-wrap:anywhere}

/* IBS Flow: account and AI workbench. Loaded after the legacy stylesheets. */
:root {
  color-scheme: light;
  --flow-bg: #f7f8fc;
  --flow-paper: #fff;
  --flow-ink: #171b28;
  --flow-muted: #596274;
  --flow-line: #d9deea;
  --flow-accent: #5144f5;
  --flow-tint: #edebff;
  --flow-cyan: #58d1de;
  --flow-danger: #a24144;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  isolation: isolate;
  color: var(--flow-ink);
  background:
    radial-gradient(ellipse 62% 42% at 100% 5%, #ebe9ff 0%, transparent 78%),
    radial-gradient(ellipse 48% 36% at 0% 80%, #e9f8fa 0%, transparent 78%),
    var(--flow-bg);
  font-size: 16px;
  line-height: 1.65;
}
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  inset: -12vh -15vw auto;
  height: min(92vh, 880px);
  pointer-events: none;
  background:
    radial-gradient(ellipse 38% 52% at 23% 42%, #dbd8ffad, transparent 82%),
    radial-gradient(ellipse 34% 46% at 79% 58%, #c7eef3a6, transparent 84%);
  transform: translate3d(-3%, 1%, 0);
  animation: flow-field 18s ease-in-out infinite alternate;
}
body > :is(header, main, footer, .skip, .skip-link) { position: relative; z-index: 1; }
@keyframes flow-field {
  to { transform: translate3d(4%, -2%, 0) scale(1.05); }
}
[hidden] { display: none !important; }
::selection { color: var(--flow-ink); background: #c8c2ff; }
a { color: var(--flow-accent); text-underline-offset: .22em; }
a:hover { color: #3425d8; }
:is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--flow-accent);
  outline-offset: 3px;
}
input, select, textarea, button { font: inherit; }
input::placeholder, textarea::placeholder { color: #727b8e; opacity: 1; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .48; cursor: not-allowed; }

body > header {
  max-width: none;
  min-height: 76px;
  padding: 14px max(28px, calc((100vw - 1320px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 0;
  border-bottom: 1px solid var(--flow-line);
  background: #fff;
  color: var(--flow-ink);
}
body > header a { color: var(--flow-ink); text-decoration: none; font-weight: 700; }
body > header a.brand { color: var(--flow-ink); }
body > header a:hover { color: var(--flow-accent); }
body > header a:first-child { font-size: 1.25rem; font-weight: 850; letter-spacing: -.035em; }
body > header .brand { display: inline-flex; align-items: center; gap: 9px; }
body > header .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: var(--flow-accent);
  color: #fff;
  font-size: 1.12rem;
}
body > header .back, body > header a:last-child { font-size: .9rem; font-weight: 650; }
body > footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 28px 38px;
  border: 0;
  color: var(--flow-muted);
  font-size: .88rem;
}
.skip, .skip-link { position: absolute; left: -9999px; }
.skip:focus, .skip-link:focus {
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--flow-accent);
  color: #fff;
}

/* Account: a clear registration action with the product boundary beside it. */
body:has(.auth) main {
  width: min(100% - 56px, 1240px);
  max-width: 1240px;
  margin: clamp(32px, 7vh, 88px) auto 70px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  gap: clamp(36px, 7vw, 112px);
  align-items: center;
}
body:has(.auth) .intro { position: relative; max-width: 620px; }
body:has(.auth) .orbit { display: none; }
body:has(.auth) h1 {
  max-width: none;
  margin: 0 0 26px;
  color: var(--flow-ink);
  font-size: clamp(3.3rem, 5.2vw, 5.8rem);
  font-weight: 850;
  letter-spacing: -.04em;
  line-height: 1.1;
}
body:has(.auth) .intro > p {
  max-width: 48ch;
  margin: 0;
  color: var(--flow-muted);
  font-size: 1.06rem;
  line-height: 1.8;
}
body:has(.auth) .boundary {
  max-width: 48ch;
  margin-top: 46px;
  padding: 22px 0 0;
  display: grid;
  gap: 6px;
  border: 0;
  border-top: 1px solid var(--flow-line);
}
body:has(.auth) .boundary strong { color: var(--flow-ink); font-size: .94rem; }
body:has(.auth) .boundary span { color: var(--flow-muted); font-size: .9rem; line-height: 1.6; }
body:has(.auth) .auth {
  min-width: 0;
  padding: clamp(25px, 3.5vw, 48px);
  border: 1px solid var(--flow-line);
  border-radius: 18px;
  background: var(--flow-paper);
  box-shadow: 0 22px 55px #202a4712;
}
body:has(.auth) .auth h2 {
  margin: 0 0 8px;
  color: var(--flow-ink);
  font-size: clamp(1.6rem, 2vw, 2.1rem);
  letter-spacing: -.03em;
}
body:has(.auth) .hint { margin: 0 0 28px; color: var(--flow-muted); font-size: .9rem; }
body:has(.auth) .auth form { display: grid; gap: 10px; margin: 0 0 18px; }
body:has(.auth) .auth label { color: var(--flow-ink); font-weight: 700; font-size: .9rem; }
body:has(.auth) .auth :is(input, textarea, select) {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 15px;
  border: 1px solid #bfc7d6;
  border-radius: 10px;
  background: #fbfcff;
  color: var(--flow-ink);
  box-shadow: none;
}
body:has(.auth) .auth :is(input, textarea, select):focus { border-color: var(--flow-accent); }
body:has(.auth) .auth button:not(.text-button),
body:has(.auth) .auth .enter {
  min-height: 50px;
  margin: 8px 0 0;
  padding: 11px 18px;
  border: 1px solid var(--flow-accent);
  border-radius: 10px;
  background: var(--flow-accent);
  color: #fff;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
}
body:has(.auth) .auth button:not(.text-button):not(:disabled):hover,
body:has(.auth) .auth .enter:hover { background: #3e31d9; }
body:has(.auth) .auth .text-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin: 3px 12px 0 0;
  padding: 8px 2px;
  border: 0;
  background: none;
  color: var(--flow-accent);
  text-align: left;
  font-weight: 650;
}
body:has(.auth) .auth #logoutAll,
body:has(.auth) .auth #logoutOthers { color: var(--flow-danger); }
body:has(.auth) .auth .enter { display: inline-flex; align-items: center; margin-right: 12px; }
body:has(.auth) .auth .status,
body:has(.auth) .auth [role="status"] { color: var(--flow-muted); line-height: 1.6; }
body:has(.auth) .auth .status.error { color: var(--flow-danger); }
body:has(.auth) .auth #accountStartupFallback {
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff5eb;
  color: #734721;
  font-size: .88rem;
}
body:has(.auth) .auth .note {
  margin: 20px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--flow-line);
  color: var(--flow-muted);
  font-size: .86rem;
}
body:has(.auth) #accountAccessDiagnostics {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--flow-line);
  border-radius: 10px;
  background: #fbfcff;
}
body:has(.auth) #accountAccessDiagnostics summary { color: var(--flow-ink); font-weight: 700; }
body:has(.auth) #accountAccessDiagnostics label { color: var(--flow-ink); }
body:has(.auth) #accountAccessDiagnosticText {
  min-height: 12rem;
  border: 1px solid var(--flow-line);
  border-radius: 8px;
  background: #fff;
  color: var(--flow-ink);
}

/* AI workspace: conversations first, connectors beside them, long records below. */
body:has(main.workspace) main.workspace {
  display: block;
  width: min(100% - 56px, 1360px);
  max-width: 1360px;
  margin: clamp(30px, 5vw, 68px) auto 80px;
  padding: 0;
  color: var(--flow-ink);
}
body:has(main.workspace) main.workspace > h1 {
  margin: 8px 0 7px;
  color: var(--flow-ink);
  font-size: clamp(2.6rem, 4.4vw, 4.3rem);
  font-weight: 850;
  letter-spacing: -.04em;
  line-height: 1.1;
}
body:has(main.workspace) main.workspace > p { max-width: 84ch; color: var(--flow-muted); }
body:has(main.workspace) #accountDataBoundary {
  width: fit-content;
  max-width: 84ch;
  margin: 0 0 26px;
  padding: 9px 14px;
  border: 1px solid var(--flow-line);
  border-radius: 9px;
  background: #fff;
  color: var(--flow-muted);
  font-size: .82rem;
}
body:has(main.workspace) main.workspace > button.text-button {
  min-height: 42px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--flow-accent);
  font-weight: 700;
}
body:has(main.workspace) #login {
  width: min(100%, 620px);
  margin-top: 32px;
  padding: 32px;
  border: 1px solid var(--flow-line);
  border-radius: 16px;
  background: #fff;
}
body:has(main.workspace) #login a { font-weight: 750; }
body:has(main.workspace) :is(#status, #networkStatus, #sendScope, #chatRequestStatuses) {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--flow-muted);
}
body:has(main.workspace) #workspace {
  display: grid;
  grid-template-columns: minmax(270px, .72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 22px;
  overflow: visible;
  margin-top: 30px;
  padding: 0;
}
body:has(main.workspace) #workspace > section,
body:has(main.workspace) #workspace > details {
  min-width: 0;
  padding: clamp(20px, 2.5vw, 32px);
  border: 1px solid var(--flow-line);
  border-radius: 16px;
  background: var(--flow-paper);
  box-shadow: 0 14px 34px #202a4709;
}
body:has(main.workspace) #workspace > section:has(#connectionForm) { order: 0; }
body:has(main.workspace) #workspace > section:has(#messageForm) { order: 1; }
body:has(main.workspace) #workspace > :is(#accountCharacterPanel, #accountDecisionPanel, #bridgeSection, #roundtableSection) {
  grid-column: 1 / -1;
}
body:has(main.workspace) #accountCharacterPanel { order: 2; }
body:has(main.workspace) #accountDecisionPanel { order: 3; }
body:has(main.workspace) #bridgeSection { order: 4; }
body:has(main.workspace) #roundtableSection { order: 5; }
body:has(main.workspace) #workspace h2 {
  margin: 0 0 22px;
  color: var(--flow-ink);
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  letter-spacing: -.025em;
  line-height: 1.24;
}
body:has(main.workspace) #workspace h3 { color: var(--flow-ink); letter-spacing: -.02em; }
body:has(main.workspace) #workspace p { color: var(--flow-muted); overflow-wrap: anywhere; }
body:has(main.workspace) #workspace :is(form, label) { min-width: 0; }
body:has(main.workspace) #workspace form { gap: 10px; }
body:has(main.workspace) #workspace label { color: var(--flow-ink); font-size: .9rem; font-weight: 650; }
body:has(main.workspace) #workspace :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #bec6d6;
  border-radius: 9px;
  background: #fcfdff;
  color: var(--flow-ink);
  box-shadow: none;
  font: inherit;
}
body:has(main.workspace) #workspace textarea { min-height: 100px; resize: vertical; }
body:has(main.workspace) #workspace :is(input[type="checkbox"], input[type="radio"]) {
  width: auto;
  min-width: auto;
  min-height: auto;
  flex: 0 0 auto;
  margin-top: .2rem;
  padding: 0;
  border: 1px solid var(--flow-line);
  background: #fff;
  color: var(--flow-ink);
  accent-color: var(--flow-accent);
}
body:has(main.workspace) #workspace :is(input, select, textarea):focus { border-color: var(--flow-accent); }
body:has(main.workspace) #workspace button {
  width: auto;
  min-height: 42px;
  margin: 4px 7px 4px 0;
  padding: 9px 14px;
  border: 1px solid var(--flow-line);
  border-radius: 9px;
  background: #fff;
  color: var(--flow-ink);
  text-align: left;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: none;
}
body:has(main.workspace) #workspace button:not(:disabled):hover { border-color: var(--flow-accent); color: var(--flow-accent); background: #f9f8ff; }
body:has(main.workspace) #workspace :is(button[type="submit"], #newChat, #sendButton) {
  border-color: var(--flow-accent);
  background: var(--flow-accent);
  color: #fff;
}
body:has(main.workspace) #workspace :is(button[type="submit"], #newChat, #sendButton):not(:disabled):hover {
  border-color: #3e31d9;
  background: #3e31d9;
  color: #fff;
}
body:has(main.workspace) #workspace :is(#clearAiData, #revokeAllConnections, #deleteSelectedChats) { color: var(--flow-danger); }
body:has(main.workspace) #workspace :is(#clearAiData, #revokeAllConnections, #deleteSelectedChats):hover {
  border-color: var(--flow-danger);
  color: var(--flow-danger);
  background: #fff7f6;
}
body:has(main.workspace) #workspace :is(.text-button, button:disabled) { box-shadow: none; }
body:has(main.workspace) #workspace details {
  min-width: 0;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: #fbfcff;
  color: var(--flow-ink);
}
body:has(main.workspace) #workspace > details { margin: 0; }
body:has(main.workspace) #workspace details summary { color: var(--flow-ink); font-weight: 750; cursor: pointer; }
body:has(main.workspace) #workspace details summary::marker { color: var(--flow-accent); }
body:has(main.workspace) #workspace details[open] > summary { margin-bottom: 16px; }
body:has(main.workspace) #workspace fieldset {
  min-width: 0;
  margin: 15px 0;
  padding: 18px;
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: #fff;
}
body:has(main.workspace) #workspace legend { padding: 0 7px; color: var(--flow-accent); font-weight: 700; }
body:has(main.workspace) #workspace :is(ul, ol) { max-width: 100%; overflow-wrap: anywhere; }
body:has(main.workspace) #workspace :is(#connections li, #messages article, #accountDecisionList li, #accountCharacterList li) {
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--flow-line);
  background: transparent;
  color: var(--flow-ink);
}
body:has(main.workspace) #messages {
  min-height: 240px;
  max-height: 48vh;
  margin: 18px 0;
  padding: 0 18px;
  overflow: auto;
  border: 1px solid var(--flow-line);
  border-radius: 12px;
  background: #fafbff;
  color: var(--flow-ink);
}
body:has(main.workspace) #workspace :is(#latestReply, #chatRequestStatuses, #comparisonPreview) {
  margin: 16px 0;
  padding: 18px;
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: #fbfcff;
}
body:has(main.workspace) #workspace :is(pre, code) {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: #353c55;
}
body:has(main.workspace) #workspace pre {
  overflow: auto;
  padding: 16px;
  border-radius: 10px;
  background: #f0f2fa;
}
body:has(main.workspace) #workspace dialog,
body:has(main.workspace) #conversationNoteDialog {
  width: min(42rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--flow-line);
  border-radius: 16px;
  background: #fff;
  color: var(--flow-ink);
  box-shadow: 0 28px 80px #19213d33;
}
body:has(main.workspace) #conversationNoteDialog textarea {
  background: #fcfdff;
  color: var(--flow-ink);
  border: 1px solid var(--flow-line);
  border-radius: 9px;
}
body:has(main.workspace) #conversationNoteDialog::backdrop { background: #171b2880; }
body:has(main.workspace) #accessDiagnostics {
  max-width: 840px;
  padding: 16px 18px;
  border: 1px solid var(--flow-line);
  border-radius: 11px;
  background: #fff;
}
body:has(main.workspace) #accessDiagnostics summary { font-weight: 700; }
body:has(main.workspace) #accessDiagnostics button.text-button {
  min-height: 42px;
  margin: 6px 8px 6px 0;
  padding: 8px 12px;
  border: 1px solid var(--flow-line);
  border-radius: 9px;
  background: #fff;
  color: var(--flow-accent);
  font-weight: 650;
}
body:has(main.workspace) #accessDiagnostics button.text-button:hover {
  border-color: var(--flow-accent);
  background: #f9f8ff;
}
body:has(main.workspace) #accessDiagnosticText {
  width: 100%;
  min-height: 10rem;
  border: 1px solid var(--flow-line);
  border-radius: 9px;
  background: #fff;
  color: var(--flow-ink);
}

@media (max-width: 900px) {
  body:has(.auth) main { grid-template-columns: 1fr; gap: 26px; align-items: start; }
  body:has(.auth) .intro { max-width: 100%; }
  body:has(.auth) h1 { max-width: none; font-size: clamp(2.5rem, 8vw, 4.1rem); }
  body:has(.auth) .boundary { margin-top: 20px; }
  body:has(main.workspace) #workspace { grid-template-columns: 1fr; }
  body:has(main.workspace) #workspace > * { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  body > header { min-height: 64px; padding: 12px 18px; }
  body > footer { padding: 24px 18px; }
  body:has(.auth) main,
  body:has(main.workspace) main.workspace { width: min(100% - 32px, 100%); margin-top: 28px; }
  body:has(.auth) .intro > p { font-size: 1rem; line-height: 1.65; }
  body:has(.auth) .auth { padding: 23px 20px; }
  body:has(.auth) .boundary { font-size: .88rem; }
  body:has(main.workspace) #workspace { gap: 16px; margin-top: 24px; }
  body:has(main.workspace) #workspace > section,
  body:has(main.workspace) #workspace > details { padding: 20px 17px; }
  body:has(main.workspace) #workspace details { padding: 13px; }
  body:has(main.workspace) #workspace fieldset { padding: 13px; }
  body:has(main.workspace) #workspace button { max-width: 100%; white-space: normal; }
  body:has(main.workspace) #messages { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
}
