:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e3e8f0;
  --line-strong: #d1d9e6;
  --text: #172033;
  --muted: #697489;
  --accent: #3858d6;
  --accent-dark: #2743b5;
  --accent-soft: #eef1ff;
  --cyan: #2aa9a1;
  --danger: #b73945;
  --warning: #b67920;
  --success: #23825e;
  --shadow: 0 18px 48px rgba(31, 42, 74, .10);
  --radius: 16px;
  --sidebar: 282px;
  --chat-width: 34%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-width: 1020px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
.hidden { display: none !important; }
.global-error { position: fixed; z-index: 1000; top: 10px; left: 50%; transform: translateX(-50%); background: #fff4f5; border: 1px solid #f0c6cb; color: #8e2631; border-radius: 12px; padding: 11px 16px; box-shadow: var(--shadow); }

#app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; gap: 18px; padding: 20px 16px; background: #11172a; color: #f7f9ff; border-right: 1px solid rgba(255,255,255,.08); z-index: 30; }
.brand-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 2px 6px 8px; color: inherit; background: transparent; border: 0; border-radius: 10px; text-align: left; cursor: pointer; }
.brand-row:hover { background: rgba(255,255,255,.06); }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-weight: 800; background: linear-gradient(145deg, #6480ff, #2dbbb2); box-shadow: 0 8px 26px rgba(70,108,255,.32); }
.brand-row strong { display: block; font-size: 18px; letter-spacing: .02em; }
.brand-row span { display: block; margin-top: 2px; color: #aeb7d2; font-size: 11px; letter-spacing: .07em; }
.sidebar-scroll { min-height: 0; overflow: auto; flex: 1; padding-right: 3px; }
.nav-section { margin-bottom: 22px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 7px; color: #8f9ab9; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.entity-list, .project-chats { display: grid; gap: 4px; }
.project-block { margin-bottom: 9px; transition: opacity .18s ease, transform .18s ease, filter .18s ease; }
.entity-row { width: 100%; border: 0; background: transparent; color: #dbe1f4; border-radius: 10px; min-height: 36px; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 8px 9px; text-align: left; transition: background .18s ease, color .18s ease, transform .18s ease; }
.entity-row:hover { background: rgba(255,255,255,.075); color: #fff; transform: translateX(1px); }
.entity-row.navigation-draggable { cursor: grab; -webkit-user-drag: none; }
.entity-row.navigation-draggable:active { cursor: grabbing; }
.navigation-dragging { opacity: .38; transform: scale(.985); filter: saturate(.75); }
.navigation-source-detached { position: fixed !important; left: -200vw !important; top: -200vh !important; width: var(--navigation-source-width) !important; margin: 0 !important; pointer-events: none !important; opacity: 0 !important; transform: none !important; }
.navigation-drag-ghost { position: fixed; left: -200vw; top: -200vh; z-index: 260; margin: 0; pointer-events: none; opacity: .94; color: #f4f6ff; background: #28324d; border: 1px solid rgba(142,160,224,.55); box-shadow: 0 16px 34px rgba(5,10,26,.36); transform: scale(.99); }
.navigation-drag-ghost.touch { opacity: .9; }
.navigation-drag-ghost .project-actions { opacity: 0; }
.navigation-drop-placeholder { box-sizing: border-box; min-height: 36px; border: 1px dashed rgba(124,150,255,.72); border-radius: 10px; background: linear-gradient(90deg,rgba(93,121,235,.16),rgba(45,187,178,.08)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.025); pointer-events: none; }
.navigation-drop-placeholder.project { margin-bottom: 9px; border-radius: 12px; }
.navigation-drop-active > .empty-nav { display: none; }
.navigation-drop-before { box-shadow: inset 0 2px #7c96ff; }
.navigation-drop-after { box-shadow: inset 0 -2px #7c96ff; }
.navigation-drop-inside { outline: 1px solid #7c96ff; outline-offset: 2px; background: rgba(93,121,235,.13); }
body.navigation-touch-active { user-select: none; overscroll-behavior: none; }
.entity-row.active { background: linear-gradient(90deg, rgba(82,112,235,.28), rgba(45,187,178,.10)); color: #fff; box-shadow: inset 2px 0 #7190ff; }
.entity-row small { color: #8590ac; }
.entity-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-heading { color: #eff2fc; font-weight: 650; }
.project-chats { margin-left: 15px; }
.project-actions { opacity: 0; transition: opacity .18s ease; }
.project-heading:hover .project-actions { opacity: 1; }
.empty-nav { padding: 8px 11px; color: #697592; font-size: 12px; }
.user-card { border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.04); color: #f8f9ff; border-radius: 14px; padding: 10px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; text-align: left; transition: .18s ease; }
.user-card:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.17); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #596fe2, #35a8a2); color: #fff; font-weight: 800; }
.avatar.large { width: 54px; height: 54px; font-size: 20px; }
.user-copy strong, .user-copy span { display: block; }
.user-copy span { color: #98a3c0; font-size: 12px; margin-top: 3px; }
.chevron { color: #7884a1; }

.main-shell { grid-column: 2; min-width: 0; }
.sidebar-toggle { border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; padding: 0; font-size: 21px; display: grid; place-items: center; }
#sidebar-collapse { align-self: flex-end; flex-shrink: 0; color: #dbe1f4; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); }
#sidebar-expand { position: fixed; top: 27px; left: 10px; z-index: 31; color: var(--text); background: #fff; }
#app-shell.sidebar-motion { transition: grid-template-columns 160ms ease-out; }
.sidebar-motion .sidebar { transition: transform 160ms ease-out, visibility 0s; }
#app-shell.sidebar-collapsed { grid-template-columns: 0px minmax(0,1fr); }
.sidebar-collapsed .sidebar { transform: translateX(-100%); visibility: hidden; pointer-events: none; }
.sidebar-motion.sidebar-collapsed .sidebar { transition: transform 160ms ease-out, visibility 0s 160ms; }
.sidebar-collapsed .topbar { padding-left: 54px; }
.topbar { height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 14px 30px; background: rgba(244,246,250,.90); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.02em; }
.page-title-row { display: flex; align-items: baseline; gap: 12px; }
.page-title-row > span { color: var(--muted); font-size: 13px; font-weight: 650; }
.topbar-actions, .toolbar-actions, .status-cluster { display: flex; align-items: center; gap: 8px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.view { padding: 28px 30px 50px; }

button, .button-link { border-radius: 10px; border: 1px solid transparent; padding: 9px 13px; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
button:hover:not(:disabled), .button-link:hover { transform: translateY(-1px); }
.primary { color: #fff; background: linear-gradient(135deg, var(--accent), #4e6bea); box-shadow: 0 8px 20px rgba(56,88,214,.20); border: 0; }
.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--accent-dark), #4260db); box-shadow: 0 10px 24px rgba(56,88,214,.28); }
.primary.large { padding: 13px 22px; font-weight: 750; }
.ghost { color: #364157; background: var(--panel); border-color: var(--line); }
.ghost:hover:not(:disabled) { border-color: #bcc7da; background: #fbfcff; }
.sidebar .primary.wide { width: 100%; }
.wide { width: 100%; }
.small { font-size: 12px; padding: 7px 9px; }
.icon-button { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; color: inherit; background: transparent; border: 0; }
.danger, .danger-text { color: var(--danger); }
.danger { background: #fff1f2; border-color: #f1c8cd; }
.button-link { text-decoration: none; color: var(--accent); background: var(--accent-soft); }

.hero-card { min-height: 252px; overflow: hidden; position: relative; padding: 38px 46px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 85% 20%, rgba(77,219,208,.25), transparent 30%), linear-gradient(135deg, #202a55 0%, #334aa6 54%, #257f89 120%); box-shadow: 0 24px 62px rgba(29,43,95,.20); }
.hero-card h2 { max-width: 900px; margin: 12px 0; font-size: clamp(30px,3vw,36px); line-height: 1.18; letter-spacing: -.04em; white-space: nowrap; }
.hero-card p:not(.eyebrow) { max-width: 900px; margin: 0; color: #dbe2ff; font-size: 16px; line-height: 1.65; }
.hero-card .eyebrow { color: #9fe5e0; font-size: 12px; }
.hero-card .primary { margin-top: 17px; background: #fff; color: #293d9e; }
.hero-orbit { position: absolute; width: 340px; height: 340px; right: -80px; bottom: -130px; border: 1px solid rgba(255,255,255,.20); border-radius: 50%; }
.hero-orbit span { position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; inset: 42px; }
.hero-orbit span:nth-child(2) { inset: 88px; }
.hero-orbit span:nth-child(3) { inset: 133px; background: rgba(255,255,255,.08); }
.landing-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.landing-section-heading h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; }
.landing-section-heading > span { color: var(--muted); font-size: 12px; }
.recent-research { margin-top: 25px; }
.recent-research-list { display: grid; gap: 8px; }
.recent-research-item { width: 100%; min-height: 72px; display: grid; grid-template-columns: minmax(190px,.8fr) 92px minmax(280px,1.5fr) auto; align-items: center; gap: 17px; padding: 13px 16px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 13px; text-align: left; box-shadow: 0 6px 20px rgba(31,42,74,.04); }
.recent-research-item:hover { border-color: #b9c5e9; background: #fbfcff; }
.recent-research-title { min-width: 0; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-research-status { justify-self: start; padding: 5px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 750; white-space: nowrap; }
.recent-research-status.completed { color: var(--success); background: #eaf8f2; }
.recent-research-status.failed, .recent-research-status.interrupted { color: var(--danger); background: #fff0f1; }
.recent-research-progress { min-width: 0; color: #59657c; font-size: 13px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-research-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.workflow-overview { margin-top: 25px; }
.principle-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.principle-grid article { padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 26px rgba(31,42,74,.05); }
.principle-grid article > span { color: var(--accent); font-weight: 800; font-size: 11px; }
.principle-grid h3 { margin: 12px 0 5px; }
.principle-grid p { color: var(--muted); margin: 0; line-height: 1.65; }

.conversation-view { height: calc(100dvh - 86px); min-height: 0; padding-top: 18px; padding-bottom: 24px; display: flex; flex-direction: column; overflow: hidden; }
.conversation-toolbar { min-height: 54px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 14px; }
.status-pill, .draft-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.status-pill { color: #43506a; background: #eef1f6; }
.draft-badge { color: var(--warning); background: #fff4d8; }
.status-cluster select { min-width: 150px; }
.contract-workspace { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0, calc(100% - var(--chat-width) - 8px)) 8px minmax(300px, var(--chat-width)); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 12px 44px rgba(31,42,74,.07); }
.contract-main { min-width: 0; overflow: auto; padding: 28px clamp(28px,4vw,64px) 50px; scroll-behavior: smooth; }
.contract-chat-panel { min-width: 300px; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; border-left: 1px solid var(--line); background: #f8f9fc; }
.panel-resizer { width: 8px; background: transparent; cursor: col-resize; position: relative; z-index: 3; }
.panel-resizer::after { content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .2s; }
.panel-resizer:hover::after, .panel-resizer.dragging::after { background: #8fa0df; }
.panel-title { min-height: 62px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-title span, .panel-title small { display: block; }
.panel-title span { font-weight: 750; }
.panel-title small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.contract-chat-list { overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-new-message { position: absolute; right: 18px; bottom: 132px; z-index: 4; padding: 7px 11px; color: var(--accent); background: #fff; border-color: #cdd6f5; box-shadow: var(--shadow); }
.contract-chat-panel { position: relative; }
.chat-empty { margin: auto; max-width: 250px; color: var(--muted); text-align: center; line-height: 1.7; }
.chat-message { max-width: 92%; border-radius: 13px; padding: 11px 13px; line-height: 1.65; box-shadow: 0 4px 14px rgba(31,42,74,.05); }
.chat-message.user { align-self: flex-end; background: #e8edff; border: 1px solid #d3dcff; }
.chat-message.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.chat-message.streaming { min-width: 72px; }
.chat-message.streaming::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.1s ease-in-out infinite; vertical-align: middle; }
.chat-message.failed { border-color: #efb3b3; color: #9f3030; }
.chat-message .chat-meta { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.contract-chat-form { padding: 13px; border-top: 1px solid var(--line); background: #fff; }
.contract-chat-form textarea { width: 100%; resize: vertical; min-height: 86px; }
.contract-chat-form > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.contract-chat-form small { color: var(--muted); line-height: 1.35; }

.contract-title { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.contract-title h1 { cursor: default; }
.contract-outline { position: sticky; top: -28px; z-index: 5; margin: 0 -10px 18px; padding: 10px; display: grid; gap: 7px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.contract-outline.compact-visible { box-shadow: 0 9px 22px rgba(31,42,74,.06); }
.contract-outline-row { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: thin; }
.contract-outline-row.minor:empty { display: none; }
.contract-outline-row.minor { padding-top: 7px; border-top: 1px solid #edf0f6; }
.contract-outline button { flex: 0 0 auto; padding: 6px 9px; color: var(--muted); background: #fff; border-color: var(--line); font-size: 11px; white-space: nowrap; }
.contract-outline-row.major button { font-weight: 700; }
.contract-outline button.active { color: var(--accent); background: var(--accent-soft); border-color: #cbd4fb; }
.contract-map { position: relative; margin: 0 0 28px; padding: 24px; overflow: hidden; border: 1px solid #dce3f2; border-radius: 18px; background: radial-gradient(circle at 88% 12%,rgba(60,174,169,.13),transparent 30%),linear-gradient(145deg,#fbfcff,#f3f6ff); box-shadow: 0 12px 32px rgba(35,53,105,.07); }
.contract-map::before { content: ""; position: absolute; inset: 78px 8% auto; height: 1px; background: linear-gradient(90deg,transparent,#aebbea 10%,#8ecfc8 90%,transparent); }
.contract-map-heading { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.contract-map-heading h2 { margin: 4px 0 0; font-size: 20px; }
.contract-map-heading > p { max-width: 390px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: right; }
.contract-map-nodes { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 10px; }
.contract-map-node { position: relative; min-width: 0; min-height: 92px; padding: 13px 10px 12px; display: grid; align-content: start; gap: 7px; text-align: left; color: #46516a; background: rgba(255,255,255,.91); border-color: #d6deef; box-shadow: 0 7px 18px rgba(36,53,100,.06); }
.contract-map-node::before { content: attr(data-section); width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: linear-gradient(145deg,#5369d7,#3aa39d); font-size: 11px; font-weight: 850; }
.contract-map-node strong { overflow: hidden; color: #293652; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; }
.contract-map-node small { color: var(--muted); font-size: 9px; line-height: 1.35; }
.contract-map-node.active { border-color: #7287e5; background: #f1f4ff; box-shadow: 0 0 0 2px rgba(83,105,215,.11),0 9px 20px rgba(36,53,100,.10); transform: translateY(-2px); }
.contract-title h2 { margin: 5px 0 0; font-size: 28px; }
.contract-section { position: relative; padding: 26px 4px 24px; border-bottom: 1px solid var(--line); }
.contract-section.editable { cursor: default; }
.contract-section.editable::after { content: "双击编辑"; position: absolute; top: 25px; right: 4px; opacity: 0; color: var(--accent); font-size: 11px; transition: opacity .16s; }
.contract-section.editable:hover::after { opacity: 1; }
.contract-section.editable:hover { background: linear-gradient(90deg, transparent, rgba(56,88,214,.025), transparent); }
.contract-subsection-intro { padding: 3px 0 11px; }
.contract-subsection-list { display: grid; gap: 14px; }
.contract-subsection-card { position: relative; padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcff; scroll-margin-top: 118px; }
.contract-subsection-card.editable:hover { border-color: #b9c6ee; box-shadow: 0 7px 20px rgba(50,70,130,.07); }
.contract-subsection-card.editable::after { content: "双击只编辑此 Node"; position: absolute; right: 13px; top: 11px; color: var(--accent); font-size: 10px; opacity: 0; transition: opacity .16s; }
.contract-subsection-card.editable:hover::after { opacity: 1; }
.contract-subsection-card > h3 { margin: 0 120px 10px 0; font-size: 17px; }
.contract-section h2, .contract-section h3 { margin: 0 0 14px; letter-spacing: -.02em; }
.contract-section h2 { font-size: 22px; }
.contract-section h3 { font-size: 18px; }
.markdown { line-height: 1.78; overflow-wrap: anywhere; }
.markdown p { margin: .7em 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 1.25em 0 .55em; }
.markdown pre { overflow: auto; background: #12182a; color: #e7ebf9; border-radius: 11px; padding: 14px; }
.markdown code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .91em; }
.markdown :not(pre) > code { padding: 2px 5px; border-radius: 5px; background: #eef1f6; color: #26324d; }
.markdown blockquote { margin: 1em 0; padding: 2px 0 2px 15px; border-left: 3px solid #9aabe7; color: #4d5870; }
.markdown table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.markdown th { background: #f5f7fb; }
.markdown a { color: var(--accent); }
.markdown mjx-container[jax="SVG"] { max-width: 100%; overflow: visible; }
.markdown mjx-container[jax="SVG"][display="true"] { margin: 1.1em 0; }
.execution-policy-card {
  --deployment-shell: #142238;
  --deployment-panel: #192a44;
  --deployment-panel-soft: #1d304d;
  --deployment-rule: rgba(148,165,201,.24);
  --deployment-text: #f1f3fa;
  --deployment-muted: #a5b0c8;
  --deployment-signal: #7777f1;
  container-type: inline-size;
  margin-top: 30px;
  overflow: hidden;
  border: 1px solid #42537a;
  border-radius: 17px;
  color: var(--deployment-text);
  background: radial-gradient(circle at 86% 2%,rgba(73,101,171,.18),transparent 31%),var(--deployment-shell);
  box-shadow: 0 25px 58px rgba(20,31,53,.22), inset 0 0 0 1px rgba(255,255,255,.025);
}
.deployment-content { min-width: 0; }
.deployment-title-row { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 20px; align-items: center; margin: 0 28px; padding: 27px 0 25px; border-bottom: 1px solid var(--deployment-rule); }
.deployment-section-kicker { width: 64px; height: 64px; display: grid; place-items: center; border: 1px solid #6267d8; border-radius: 10px; color: #fff; background: linear-gradient(145deg,#2d327e,#252b68); box-shadow: inset 0 0 22px rgba(116,119,241,.19),0 8px 21px rgba(16,20,55,.22); font-family: "Iowan Old Style","Palatino Linotype",Georgia,serif; font-size: 40px; line-height: 1; text-shadow: 0 0 14px rgba(193,198,255,.25); }
.deployment-title-copy p { margin: 0 0 5px; color: var(--deployment-muted); font-size: 10px; font-weight: 760; letter-spacing: .12em; text-transform: uppercase; }
.deployment-title-copy h2 { margin: 0; color: var(--deployment-text); font-family: "Iowan Old Style","Palatino Linotype","Noto Serif SC","Songti SC",Georgia,serif; font-size: clamp(24px,3.1cqi,35px); font-weight: 500; letter-spacing: .025em; line-height: 1.05; }
.deployment-title-copy > span { display: block; margin-top: 7px; color: var(--deployment-muted); font-size: 11px; }
.deployment-contract-meta { display: flex; align-items: center; justify-content: flex-end; color: var(--deployment-muted); text-align: right; }
.deployment-contract-meta strong, .deployment-contract-meta small { display: block; }
.deployment-contract-meta strong { color: #c3cbe0; font-size: 12px; letter-spacing: .055em; }
.deployment-contract-meta small { margin-top: 5px; font-size: 8px; letter-spacing: .08em; }
.deployment-controls { padding: 24px 28px 22px; display: grid; gap: 24px; }
.deployment-choice-group { display: grid; gap: 12px; }
.deployment-language-group { max-width: 430px; }
.deployment-language-group select { width: 100%; min-height: 44px; padding: 0 13px; color: var(--deployment-text); background: var(--deployment-panel); border-color: var(--deployment-rule); }
.deployment-choice-heading { display: flex; align-items: baseline; gap: 16px; }
.deployment-choice-heading span { color: var(--deployment-text); font-size: 11px; font-weight: 820; letter-spacing: .08em; }
.deployment-choice-heading small { color: var(--deployment-muted); font-size: 10px; }
.deployment-qwen-note { min-width: 0; margin-left: auto; color: #7eced0; font-size: clamp(8px,1.1cqi,10px); font-style: normal; letter-spacing: 0; line-height: 1; white-space: nowrap; }
.deployment-options { display: grid; gap: 13px; }
.deployment-model-options { grid-template-columns: repeat(4,minmax(0,1fr)); }
.deployment-duration-options { grid-template-columns: repeat(3,minmax(0,1fr)); }
.deployment-option { position: relative; margin: 0; border: 1px solid var(--deployment-rule); border-radius: 9px; color: #d8deed; background: rgba(11,21,37,.30); box-shadow: inset 0 1px rgba(255,255,255,.025); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease; }
.deployment-option:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(132,144,236,.65); background: rgba(33,50,79,.74); box-shadow: 0 9px 18px rgba(3,9,22,.14); }
.deployment-option:focus-visible { outline: 2px solid #9292ff; outline-offset: 3px; }
.deployment-option[aria-checked="true"] { border-color: #7476f1; color: #fff; background: linear-gradient(135deg,rgba(54,58,148,.90),rgba(72,76,184,.78)); box-shadow: 0 0 0 1px rgba(119,119,241,.16),0 10px 24px rgba(31,34,118,.27),inset 0 0 25px rgba(105,105,235,.17); }
.deployment-option.reserve[aria-checked="true"] { border-color: #7185a8; background: linear-gradient(135deg,rgba(50,68,94,.92),rgba(61,82,108,.82)); box-shadow: 0 0 0 1px rgba(126,148,180,.12),0 10px 24px rgba(12,24,41,.22); }
.execution-policy-card .deployment-option:disabled { opacity: .78; }
.deployment-model-option { min-height: 82px; padding: 14px; display: grid; grid-template-columns: 38px minmax(0,1fr) 20px; gap: 12px; align-items: center; text-align: left; }
.deployment-option-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(148,165,201,.19); border-radius: 8px; background: rgba(8,16,30,.20); }
.deployment-option-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.deployment-option-copy { min-width: 0; }
.deployment-option-copy strong, .deployment-option-copy small { display: block; overflow: visible; text-overflow: clip; white-space: normal; text-wrap: pretty; }
.deployment-option-copy strong { font-size: 13px; font-weight: 650; line-height: 1.25; }
.deployment-option-copy small { margin-top: 5px; color: var(--deployment-muted); font-size: 8px; font-weight: 520; line-height: 1.38; letter-spacing: .005em; }
.deployment-option-copy small span { display: block; }
.deployment-option-check { width: 19px; height: 19px; display: grid; place-items: center; align-self: start; border-radius: 50%; color: #354186; background: #dfe5f7; opacity: 0; transform: scale(.75); transition: opacity .16s ease,transform .16s ease; }
.deployment-option-check svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.deployment-option[aria-checked="true"] .deployment-option-check { opacity: 1; transform: scale(1); }
.deployment-duration-option { min-height: 77px; padding: 13px 36px; display: grid; place-items: center; text-align: center; }
.deployment-duration-option .deployment-option-copy strong { font-size: 17px; }
.deployment-duration-option .deployment-option-copy small { margin-top: 7px; font-size: 10px; }
.deployment-duration-option .deployment-option-check { position: absolute; top: 11px; right: 11px; }
.deployment-accessible-description { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.deployment-slogan-stage { --deployment-background-image: url('/static/assets/deployment/gpt-medium-3h.webp'); position: relative; min-height: 245px; margin: 0 28px 23px; padding: 38px 44px; display: flex; flex-direction: column; justify-content: center; overflow: hidden; border: 1px solid rgba(148,165,201,.21); border-radius: 10px; color: #fff; background-image: linear-gradient(90deg,rgba(10,21,38,.96) 0%,rgba(10,21,38,.82) 42%,rgba(10,21,38,.24) 71%,rgba(10,21,38,.04) 100%),var(--deployment-background-image); background-position: center; background-size: cover; box-shadow: inset 0 0 40px rgba(2,8,19,.24); }
.deployment-slogan-stage blockquote { position: relative; z-index: 1; width: min(57%,570px); margin: 0; font-family: "Iowan Old Style","Palatino Linotype","Noto Serif SC","Songti SC",Georgia,serif; font-size: clamp(25px,3.25cqi,38px); font-weight: 400; line-height: 1.53; letter-spacing: .015em; white-space: pre-line; text-wrap: balance; text-shadow: 0 3px 13px rgba(0,0,0,.32); transition: opacity .14s ease,transform .14s ease; }
.deployment-slogan-stage[data-slogan-key="gpt_medium:balanced_3h"] blockquote { width: min(70%,660px); text-wrap: wrap; }
.deployment-slogan-stage figcaption { position: relative; z-index: 1; margin-top: 17px; color: #afb7c7; font-size: 10px; font-style: italic; letter-spacing: .035em; }
.deployment-slogan-stage.is-changing blockquote,.deployment-slogan-stage.is-changing figcaption { opacity: 0; transform: translateY(4px); }
.deployment-hud { margin: 0 28px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); overflow: hidden; border: 1px solid var(--deployment-rule); border-radius: 9px; background: rgba(9,19,35,.29); }
.deployment-hud > div { min-width: 0; min-height: 78px; padding: 15px 17px; display: flex; align-items: center; gap: 13px; border-right: 1px solid var(--deployment-rule); }
.deployment-hud > div:last-child { border-right: 0; }
.deployment-hud svg { width: 26px; height: 26px; flex: 0 0 auto; fill: none; stroke: var(--deployment-signal); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.deployment-hud span { min-width: 0; }
.deployment-hud small,.deployment-hud strong,.deployment-hud em { display: block; }
.deployment-hud small { color: var(--deployment-muted); font-size: 8px; font-weight: 750; letter-spacing: .08em; }
.deployment-hud strong { margin-top: 5px; overflow: hidden; color: var(--deployment-text); font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.deployment-hud em { margin-top: 3px; color: #7f8ca7; font-size: 8px; font-style: normal; }
.contract-section-heading { display: flex; align-items: flex-start; gap: 13px; }
.contract-section-heading > span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--accent); font-weight: 800; }
.contract-section-heading h2 { margin: 0; }
.contract-section-heading p { margin: 4px 0 0; color: var(--muted); }
.form-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.request-save-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.request-generation-estimate { color: var(--muted); font-size: 12px; }
.execution-estimate { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.execution-estimate > div { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.execution-estimate span, .execution-estimate strong { display: block; }
.execution-estimate span { color: var(--muted); font-size: 11px; }
.execution-estimate strong { margin-top: 4px; font-size: 18px; }
.execution-estimate small { grid-column: 1/-1; color: var(--muted); }
.approve-zone { margin: 21px 28px 27px; padding-top: 21px; display: grid; grid-template-columns: minmax(0,1fr) minmax(300px,42%); gap: 24px; align-items: center; border-top: 1px solid var(--deployment-rule); }
.deployment-lock-note { min-width: 0; display: flex; align-items: center; gap: 13px; color: var(--deployment-muted); }
.deployment-lock-note > svg { width: 27px; height: 27px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.deployment-lock-note p { margin: 0; font-size: 10px; line-height: 1.5; }
.deployment-lock-note span,.deployment-lock-note small { display: block; }
.deployment-lock-note small { margin-top: 3px; color: #7f8ca6; font-size: 9px; }
.deployment-launch { min-height: 66px; padding: 11px 15px 11px 20px; display: grid; grid-template-columns: 27px minmax(0,1fr) 20px; gap: 13px; align-items: center; border: 1px solid #7779f2; border-radius: 9px; color: #fff; background: linear-gradient(115deg,#383b9e,#5558d2); box-shadow: 0 13px 27px rgba(31,34,118,.28),inset 0 0 0 1px rgba(255,255,255,.07); text-align: left; }
.deployment-launch:hover:not(:disabled) { transform: translateY(-1px); border-color: #9294ff; background: linear-gradient(115deg,#4145ad,#5e61dd); box-shadow: 0 16px 31px rgba(31,34,118,.35),inset 0 0 0 1px rgba(255,255,255,.09); }
.deployment-launch > svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.deployment-launch span,.deployment-launch strong,.deployment-launch small { display: block; }
.deployment-launch strong { font-size: 15px; font-weight: 560; }
.deployment-launch small { margin-top: 4px; color: #c7c9f3; font-size: 8px; font-weight: 600; letter-spacing: .07em; }
.deployment-launch b { justify-self: end; color: #aeb3ee; font-size: 30px; font-weight: 300; line-height: 1; }

@container (max-width: 760px) {
  .deployment-title-row { grid-template-columns: 55px minmax(0,1fr); margin-inline: 22px; }
  .deployment-section-kicker { width: 55px; height: 55px; font-size: 34px; }
  .deployment-contract-meta { display: none; }
  .deployment-controls { padding-inline: 22px; }
  .deployment-model-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .deployment-slogan-stage { margin-inline: 22px; padding-inline: 31px; }
  .deployment-slogan-stage blockquote { width: min(64%,480px); }
  .deployment-hud { margin-inline: 22px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .deployment-hud > div:nth-child(2) { border-right: 0; }
  .deployment-hud > div:nth-child(-n+2) { border-bottom: 1px solid var(--deployment-rule); }
  .approve-zone { margin-inline: 22px; grid-template-columns: 1fr; }
}
@container (max-width: 520px) {
  .deployment-title-row { grid-template-columns: 1fr; }
  .deployment-section-kicker { display: none; }
  .deployment-title-copy h2 { font-size: 25px; }
  .deployment-model-options,.deployment-duration-options { grid-template-columns: 1fr; }
  .deployment-slogan-stage { min-height: 225px; background-position: 64% center; }
  .deployment-slogan-stage blockquote { width: 76%; font-size: 26px; }
  .deployment-hud { grid-template-columns: 1fr; }
  .deployment-hud > div { border-right: 0; border-bottom: 1px solid var(--deployment-rule); }
  .deployment-hud > div:last-child { border-bottom: 0; }
}

.generation-state { margin: 38px auto; max-width: 820px; padding: 30px; display: grid; grid-template-columns: 65px 1fr; gap: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.generation-symbol { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); display: grid; place-items: center; }
.generation-symbol span { width: 21px; height: 21px; border: 2px solid #aebbf0; border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
.generation-state h2 { margin: 5px 0 8px; }
.generation-state p { color: var(--muted); }
.generation-actions { display: flex; gap: 8px; }

.run-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.run-summary-actions { display: flex; align-items: center; gap: 8px; }
.run-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.run-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(340px,1fr); grid-template-rows: 320px 320px; gap: 16px; }
.run-card { min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.graph-card { grid-row: 1/3; grid-column: 1; }
.compact-run-card { height: 320px; position: relative; }
.node-grid, .event-list, .claim-list { padding: 16px; display: grid; align-content: start; gap: 10px; overflow: auto; }
.node-grid { max-height: 515px; grid-template-columns: minmax(0,1fr); }
.node-grid.research-loading-active { min-height: 430px; align-content: stretch; padding: 20px; overflow: hidden; }
.research-loading { min-height: 100%; padding: 40px; display: grid; place-items: center; text-align: center; border: 1px solid #d8deec; border-radius: 14px; background: radial-gradient(circle at 50% 20%,rgba(56,88,214,.07),transparent 42%),linear-gradient(180deg,#fbfcff,#f5f7fc); }
.research-loading-inner { max-width: 720px; }
.research-loading-status { margin: 0; color: #7180a2; font-size: 9px; font-weight: 850; letter-spacing: .19em; }
.research-loading-quote { margin: 21px auto 0; color: #2b3650; font-family: Georgia,"Noto Serif SC","Songti SC",serif; font-size: clamp(19px,2.1vw,27px); line-height: 1.65; transition: opacity .14s ease, transform .14s ease; }
.research-loading-quote.is-changing { opacity: 0; transform: translateY(4px); }
.event-list, .claim-list { height: calc(100% - 62px); max-height: none; overscroll-behavior: contain; }
.node-card, .claim-item, .event-item { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 13px; }
.node-card.discovery { border-left: 3px solid #2fa49c; }
.node-card.claim { border-left: 3px solid #5571da; }
.node-card h3 { margin: 10px 0 6px; }
.node-card .node-summary { margin: 0 0 8px; color: #59657c; line-height: 1.55; }
.node-card .node-summary > :first-child { margin-top: 0; }
.node-card .node-summary > :last-child { margin-bottom: 0; }
.kind-tag { color: var(--accent); font-size: 10px; font-weight: 800; text-transform: uppercase; margin-right: 7px; }
.event-item { display: grid; grid-template-columns: 1fr auto; }
.event-item span { color: var(--accent); font-weight: 750; font-size: 12px; }
.event-item > .markdown { grid-column: 1/-1; margin-top: 6px; color: #59657c; line-height: 1.55; }
.event-item > .markdown > :first-child { margin-top: 0; }
.event-item > .markdown > :last-child { margin-bottom: 0; }
.event-item small { color: #9aa3b5; }
.run-progress-shell { display: grid; grid-template-columns: minmax(260px,1fr) minmax(300px,1.4fr) auto; align-items: center; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--panel-soft); }
.run-progress-copy strong, .run-progress-copy span { display: block; }
.run-progress-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.run-progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e5e9f3; }
.run-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent),var(--cyan)); transition: width .3s ease; }
.run-progress-track.terminal-error span { background: linear-gradient(90deg,#b73a3a,#d9685a); }
.run-progress-track.paused span { background: linear-gradient(90deg,#8b7b52,#b99a58); }
.run-token-strip { display: flex; align-items: center; gap: 15px; white-space: nowrap; }
.run-token-strip span { display: grid; gap: 2px; }
.run-token-strip small { color: var(--muted); font-size: 9px; }
.run-token-strip strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.run-token-strip .cached strong { color: #59657c; }
.panel-new-count { flex: 0 0 auto; width: auto; padding: 6px 9px; border: 1px solid #cdd6f5; border-radius: 999px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 750; }
.claim-item { cursor: pointer; }
.claim-item:hover { border-color: #b9c5ed; background: #fbfcff; }
.claim-item .claim-heading { display: flex; justify-content: space-between; gap: 10px; color: var(--success); font-size: 11px; font-weight: 800; }
.claim-item .claim-preview { margin-top: 7px; color: #59657c; line-height: 1.5; }
.claim-item .claim-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.claim-item .claim-preview > :first-child { margin-top: 0; }
.claim-item .claim-preview > :last-child { margin-bottom: 0; }
.claim-item.new-result { animation: claim-highlight 2.2s ease; }
@keyframes claim-highlight { 0%,35% { background: #eefbf6; border-color: #8bcdb3; } 100% { background: #fff; border-color: var(--line); } }
.request-snapshot-section { cursor: default; }

input, textarea, select { width: 100%; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: #8da1ef; box-shadow: 0 0 0 3px rgba(56,88,214,.10); }
label { display: grid; gap: 7px; color: #455168; font-size: 12px; font-weight: 650; }
label em { color: var(--danger); font-style: normal; font-size: 10px; }
fieldset { margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
legend { color: #4e5a72; font-size: 12px; font-weight: 700; padding: 0 5px; }

.dialog-card { width: min(720px, calc(100vw - 40px)); max-height: calc(100vh - 42px); overflow: auto; border: 0; border-radius: 18px; padding: 28px; color: var(--text); box-shadow: 0 30px 100px rgba(15,23,42,.30); }
.dialog-card::backdrop, .section-editor-dialog::backdrop { background: rgba(16,22,41,.52); backdrop-filter: blur(3px); }
.dialog-card h2 { margin: 5px 0 10px; }
.dialog-card.regenerate-dialog {
  width: 80vw;
  height: 80vh;
  min-width: min(760px, calc(100vw - 24px));
  min-height: min(560px, calc(100vh - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  resize: both;
  overflow: auto;
}
.regenerate-dialog form { width: 100%; height: 100%; display: flex; flex-direction: column; }
.regenerate-instruction-field { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; color: #455168; font-size: 12px; font-weight: 650; }
.regenerate-instruction-label { flex: 0 0 auto; }
.regenerate-dialog textarea { flex: 1; min-height: 280px; max-height: none; resize: none; line-height: 1.65; }
.regenerate-instruction-preview { flex: 1; min-height: 280px; overflow: auto; padding: 16px 18px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: #fff; cursor: text; font-size: 14px; font-weight: 400; }
.regenerate-instruction-preview:focus { border-color: #8da1ef; box-shadow: 0 0 0 3px rgba(56,88,214,.10); outline: none; }
.regenerate-instruction-hint { flex: 0 0 auto; color: var(--muted); font-weight: 500; text-align: right; }
.regenerate-base-version { margin: 14px 0 0; padding: 11px 13px; border: 1px solid #cdd6f5; border-radius: 10px; color: #34466f; background: #f5f7ff; font-size: 13px; font-weight: 700; }
.paper-preview-dialog { width: calc(100vw - 42px); height: calc(100vh - 42px); max-width: none; max-height: none; padding: 0; overflow: hidden; }
.paper-preview-dialog[open] { display: grid; grid-template-rows: 70px minmax(0,1fr); }
.paper-preview-dialog iframe { width: 100%; height: 100%; border: 0; background: #eef1f7; }
.beta-feedback { margin: 22px 0 0; padding: 15px 17px; color: #40506b; background: #f2f5ff; border: 1px solid #d7dff7; border-radius: 12px; line-height: 1.65; }
.beta-feedback a { color: var(--accent); }
.verified-math-dialog { width: min(900px,calc(100vw - 48px)); height: min(760px,calc(100vh - 48px)); padding: 0; overflow: hidden; }
.verified-math-dialog[open] { display: grid; grid-template-rows: 70px minmax(0,1fr); }
.verified-dialog-body { min-height: 0; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; padding: 0 28px 54px; }
.verified-dialog-toolbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0 14px; background: var(--panel); }
.verified-dialog-toolbar .status-pill { display: inline-flex; margin: 0; color: var(--success); background: #eaf8f2; }
.verified-dialog-toolbar button { flex: 0 0 auto; }
.dialog-close { position: absolute; right: 14px; top: 13px; width: 34px; height: 34px; padding: 0; background: transparent; border: 0; font-size: 24px; color: #7f899d; }
.contract-request-dialog { width: min(1080px, calc(100vw - 54px)); }

.login-page { min-width: 0; min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 12% 8%, rgba(88,105,190,.08), transparent 30%), linear-gradient(145deg,#f6f7fb,#eef2f7); }
.login-shell { width: min(980px, 100%); min-height: 560px; display: grid; grid-template-columns: 1.08fr .92fr; overflow: hidden; border: 1px solid #dde3ed; border-radius: 26px; background: #fbfcff; box-shadow: 0 28px 80px rgba(24,34,67,.14); }
.login-brand-panel { position: relative; isolation: isolate; overflow: hidden; padding: 64px; display: flex; flex-direction: column; justify-content: center; background: radial-gradient(circle at 18% 20%,rgba(105,113,216,.24),transparent 34%), radial-gradient(circle at 92% 84%,rgba(80,154,184,.18),transparent 40%), linear-gradient(145deg,#10162a 0%,#19223e 52%,#243553 100%); color: #f7f8ff; }
.login-brand-panel::before { content: ""; position: absolute; z-index: -1; inset: 0; opacity: .48; background-image: linear-gradient(rgba(180,191,234,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(180,191,234,.055) 1px,transparent 1px); background-size: 52px 52px; -webkit-mask-image: linear-gradient(135deg,rgba(0,0,0,.8),transparent 78%); mask-image: linear-gradient(135deg,rgba(0,0,0,.8),transparent 78%); }
.login-brand-panel::after { content: ""; position: absolute; z-index: -1; width: 330px; height: 330px; right: -180px; bottom: -170px; border: 1px solid rgba(181,196,239,.13); border-radius: 50%; box-shadow: 0 0 0 58px rgba(153,172,226,.035),0 0 0 116px rgba(106,163,190,.025); }
.login-brand-panel .eyebrow { margin-bottom: 8px; color: #b9c4ee; font-size: 14px; letter-spacing: .15em; }
.login-brand-panel h1 { max-width: 520px; margin: 9px 0 24px; font-size: clamp(2rem,2.5vw,2.2rem); line-height: 1.08; letter-spacing: -.045em; }
.login-brand-panel h1 span { display: block; white-space: nowrap; }
.login-brand-panel p:last-child { max-width: 420px; margin: 0; color: rgba(236,240,255,.72); font-size: 15px; line-height: 1.8; }
.login-form-panel { padding: 64px 54px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(180deg,#fdfdff,#f8faff); }
.login-form-panel form { display: grid; gap: 20px; }
.login-form-panel .eyebrow { color: #5868bd; font-size: 11px; }
.login-form-panel h2 { margin: 0; font-size: 1.75rem; letter-spacing: -.025em; }
.login-form-panel .support-note { max-width: 380px; margin: 0; color: #727d91; }
.login-form-panel .support-note > span { display: block; }
.login-email-recommendation { margin-top: 7px; color: #58699d; font-weight: 620; }
.login-form-panel label { display: grid; gap: 8px; color: #414d64; font-size: 13px; font-weight: 650; }
.login-form-panel input { min-height: 49px; border-color: #dce3ed; background: rgba(255,255,255,.94); font-size: 15px; box-shadow: inset 0 1px 2px rgba(28,39,73,.025); }
.login-form-panel input:focus { border-color: #8293dc; box-shadow: 0 0 0 3px rgba(78,99,190,.11); }
.login-form-panel .primary { min-height: 48px; font-weight: 720; background: linear-gradient(135deg,#5067cf,#6877d2); box-shadow: 0 9px 22px rgba(72,91,181,.20); }
.login-form-panel .primary:hover:not(:disabled) { background: linear-gradient(135deg,#465dc4,#5f6dc8); box-shadow: 0 11px 26px rgba(72,91,181,.25); }
.login-secondary-actions { display: flex; gap: 10px; }
.login-secondary-actions > * { flex: 1; }
.login-status { min-height: 24px; margin: 20px 0 0; color: var(--muted); }
.login-status.error { color: var(--danger); }
@media (max-width: 760px) { .login-page { padding: 18px; } .login-shell { grid-template-columns: 1fr; } .login-brand-panel { min-height: 250px; padding: 36px; } .login-brand-panel h1 { margin-bottom: 18px; font-size: 1.85rem; } .login-brand-panel p:last-child { font-size: 14px; } .login-form-panel { padding: 38px 36px; } }
@media (max-width: 420px) { .login-brand-panel h1 span { white-space: normal; } }
.request-section-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.request-primary { grid-column: 1/-1; }
.request-block { border: 1px solid var(--line); background: var(--panel-soft); border-radius: 13px; padding: 12px; }
.request-block textarea { height: 132px; min-height: 132px; max-height: 132px; resize: none; overflow: auto; background: #fff; }
.request-primary textarea { height: 174px; min-height: 174px; max-height: 174px; }
.request-markdown-preview { height: 132px; min-height: 132px; max-height: 132px; overflow: auto; padding: 10px 11px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: text; }
.request-primary .request-markdown-preview { height: 174px; min-height: 174px; max-height: 174px; }
.request-preview-hint { color: var(--muted); font-size: 10px; font-weight: 500; text-align: right; }
.request-editor-dialog[open] { display: grid; grid-template-rows: 70px minmax(0,1fr); }
.request-editor-dialog .section-editor-split { min-height: 0; }
.support-note { color: var(--muted); line-height: 1.6; }
.dialog-actions { margin-top: 20px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.split-actions { display: grid; grid-template-columns: auto 1fr auto auto; }
.small-dialog { width: min(500px, calc(100vw - 40px)); }
.prose-dialog { width: min(760px, calc(100vw - 40px)); }
.user-dialog { width: min(650px, calc(100vw - 40px)); }
#preferences-form { display: grid; gap: 10px; margin-top: 20px; }
#admin-users .inline-admin-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
#admin-users .inline-admin-form input { flex: 1; min-width: 160px; }
#admin-users .admin-list { display: grid; gap: 12px; }
#admin-users .admin-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 20px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
#admin-users .admin-row small { display: block; margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
#admin-users .chip-row { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
#admin-users .chip { padding: 5px 9px; border-radius: 8px; background: var(--panel-soft); border: 1px solid var(--line); font-size: 12px; }
#admin-users .admin-credit-windows { flex-basis: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
#admin-users .admin-credit-windows > strong { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
#admin-users .admin-row > div:last-child { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.admin-dialog { width: min(1120px, calc(100vw - 40px)); }
.user-dialog-head { display: flex; align-items: center; gap: 14px; }
.usage-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 20px 0; }
.usage-grid article { padding: 13px; border-radius: 12px; background: #f5f7fb; border: 1px solid var(--line); }
.usage-grid span, .usage-grid strong { display: block; }
.usage-grid span { color: var(--muted); font-size: 10px; }
.usage-grid strong { margin-top: 4px; }
.account-summary { grid-template-columns: repeat(3,1fr); margin-bottom: 14px; }
.usage-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.usage-toolbar select { width: auto; min-width: 130px; padding: 7px 34px 7px 10px; }
.dev-switcher { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 7px; }
.inline-upload { display: flex; align-items: center; gap: 8px; }
.inline-upload input { flex: 1; }
.request-file-dropzone { margin-top: 5px; padding: 20px; display: grid; place-items: center; gap: 5px; border: 1px dashed #aab8df; border-radius: 12px; color: #44506b; background: #f8faff; text-align: center; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.request-file-dropzone:hover, .request-file-dropzone:focus-visible, .request-file-dropzone.drag-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(56,88,214,.09); outline: none; }
.request-file-dropzone > span { color: var(--muted); font-size: 11px; font-weight: 500; }
.request-upload-state { margin-top: 9px; color: var(--accent); font-size: 12px; font-weight: 650; }
.request-upload-state.error { color: var(--danger); }
.request-library-picker { margin-top: 12px; }
.request-file-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.request-file-row > span { min-width: 0; }
.request-file-row strong, .request-file-row small { display: block; }
.request-file-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-file-row small { margin-top: 2px; color: var(--muted); }
.file-picker, .file-list { display: grid; gap: 8px; margin-top: 10px; max-height: 260px; overflow: auto; }
.file-check, .file-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.file-check input { width: auto; }
.file-check span, .file-check strong, .file-check small { display: block; }
.file-check small, .file-row small { color: var(--muted); margin-top: 2px; }
.file-row { justify-content: space-between; }
.draft-save-status { margin-top: 9px; color: var(--muted); font-size: 11px; }
.workflow-list { display: grid; gap: 13px; padding-left: 23px; }
.workflow-list li { padding-left: 5px; }
.workflow-list strong, .workflow-list span { display: block; }
.workflow-list span { color: var(--muted); margin-top: 4px; line-height: 1.55; }
.admin-tabs { display: flex; gap: 6px; margin: 15px 0; border-bottom: 1px solid var(--line); }
.admin-tabs button { background: transparent; border: 0; border-radius: 0; color: var(--muted); }
.admin-tabs button.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.admin-panel { max-height: 580px; overflow: auto; }
.admin-membership-dialog { width: min(820px, calc(100vw - 40px)); height: min(720px, calc(100vh - 42px)); padding: 0; overflow: hidden; }
.admin-membership-dialog[open] { display: grid; }
.admin-membership-dialog form { min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.admin-membership-dialog header { padding: 25px 28px 16px; border-bottom: 1px solid var(--line); }
.admin-membership-dialog header h2 { margin: 5px 0 8px; }
.admin-membership-dialog header .support-note { margin: 0 44px 14px 0; }
.admin-membership-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 20px; background: #f8f9fc; }
.admin-membership-list .empty-state { padding: 34px 12px; color: var(--muted); text-align: center; }
.admin-membership-option { display: flex; align-items: center; gap: 12px; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--text); background: #fff; cursor: pointer; }
.admin-membership-option:hover { border-color: #bdc8ec; background: #fbfcff; }
.admin-membership-option input { width: auto; flex: 0 0 auto; }
.admin-membership-option > span { min-width: 0; flex: 1; }
.admin-membership-option strong, .admin-membership-option small { display: block; }
.admin-membership-option small { margin-top: 3px; color: var(--muted); font-weight: 500; overflow-wrap: anywhere; }
.admin-membership-option.readonly { cursor: default; background: #f1f3f7; }
.admin-membership-option.readonly:hover { border-color: var(--line); }
.admin-membership-lock { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #657086; background: #e5e9f1; font-size: 10px; font-weight: 750; }
.admin-membership-dialog .dialog-actions { margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); background: #fff; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table td, .admin-table th { padding: 9px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; }

.section-editor-dialog { width: calc(100vw - 34px); height: calc(100vh - 34px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 17px; overflow: hidden; box-shadow: 0 30px 100px rgba(15,23,42,.34); }
.section-editor-shell { height: 100%; display: grid; grid-template-rows: 70px minmax(0,1fr) auto; background: #fff; }
.section-editor-shell > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.section-editor-shell h2 { margin: 4px 0 0; font-size: 20px; }
.section-editor-actions { display: flex; align-items: center; gap: 10px; }
.section-editor-actions > span { color: var(--muted); font-size: 11px; }
.section-editor-split { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 8px minmax(0,1fr); }
.section-editor-split textarea { height: 100%; resize: none; border: 0; border-radius: 0; padding: 22px; background: #111725; color: #e7ebf7; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.65; outline: none; }
.section-preview { height: 100%; overflow: auto; padding: 24px 30px 80px; }
.validation-box { margin: 0; padding: 10px 18px; color: #8a2c36; background: #fff2f3; border-top: 1px solid #efc9cd; }
/* Actual full-screen Working Draft editor structure. */
.section-editor-dialog[open] { display: grid; grid-template-rows: auto minmax(0,1fr) auto; }
.fragment-identity { display: flex; align-items: end; gap: 12px; margin-top: 9px; }
.fragment-identity label { display: grid; grid-template-columns: auto minmax(260px,520px); align-items: center; gap: 8px; }
.fragment-identity input { padding: 7px 9px; }
.fragment-id { flex: 0 0 auto; padding: 7px 10px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 800; letter-spacing: .03em; }
.editor-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-dialog-head h2 { margin: 4px 0 0; font-size: 20px; }
.editor-status-row { display: flex; align-items: center; gap: 12px; }
.dialog-close.inline { position: static; flex: 0 0 auto; }
.section-split { min-height: 0; height: 100%; }
.editor-divider { height: 100%; }
#section-validation { margin: 0; border-radius: 0; }

.entity-context-menu { position: fixed; z-index: 240; min-width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: var(--shadow); }
.entity-context-menu button { width: 100%; display: block; border: 0; padding: 9px 11px; color: var(--text); background: transparent; text-align: left; }
.entity-context-menu button:hover { transform: none; background: var(--panel-soft); }
.entity-context-menu button.danger-text { color: var(--danger); }


.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(16,22,41,.35); backdrop-filter: blur(2px); }
.busy-card { min-width: 320px; max-width: 520px; padding: 26px; background: #fff; border-radius: 16px; box-shadow: var(--shadow); text-align: center; }
.busy-card p { color: var(--muted); }
.spinner { width: 34px; height: 34px; margin: 0 auto 15px; border: 3px solid #e0e5f4; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: .25; } 50% { opacity: 1; } }
.empty-state { max-width: 620px; margin: 70px auto; padding: 34px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); }
.empty-state p, .muted { color: var(--muted); }
.empty-state.workflow-active { width: min(760px,100%); max-width: 760px; padding: 20px; text-align: left; }
.generation-workflow { display: grid; gap: 10px; }
.generation-elapsed { padding: 3px 4px 7px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.generation-phase { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 13px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcff; }
.generation-phase-marker { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid #cbd2e0; border-radius: 50%; color: #fff; }
.generation-phase-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.generation-phase-status { color: var(--muted); font-size: 11px; font-weight: 750; }
.generation-phase-copy { margin: 4px 0 0; font-size: 13px; line-height: 1.55; }
.generation-phase.running { border-color: #bdc9ef; background: #f8f9ff; }
.generation-phase.running .generation-phase-marker { border-color: #c4ccee; border-top-color: var(--accent); animation: spin .8s linear infinite; }
.generation-phase.running .generation-phase-status { color: var(--accent); }
.generation-phase.completed .generation-phase-marker { border-color: #2f9a73; background: #2f9a73; }
.generation-phase.completed .generation-phase-marker::after { content: "✓"; font-size: 14px; font-weight: 850; }
.generation-phase.completed .generation-phase-status { color: #247a5d; }
.generation-phase.interrupted { border-color: #e6c77e; background: #fffaf0; }
.generation-phase.interrupted .generation-phase-marker { border-color: #c89222; }
.generation-phase.interrupted .generation-phase-marker::after { content: "!"; color: #9a6b0a; font-size: 13px; font-weight: 850; }
.generation-phase.interrupted .generation-phase-status { color: #9a6b0a; }
.generation-resume-actions { margin-top: 4px; padding: 15px 16px; border-radius: 13px; background: #fff7e7; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.generation-resume-actions p { margin: 0; color: #78591d; font-size: 13px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { max-width: 430px; padding: 10px 10px 10px 15px; border-radius: 11px; color: #fff; background: #2e3a55; box-shadow: var(--shadow); animation: toast-in .18s ease; display: flex; align-items: center; gap: 12px; }
.toast > span { flex: 1; }
.toast button { padding: 2px 6px; color: inherit; background: transparent; border: 0; font-size: 18px; }
.toast.error { background: #9d3540; }
.entity-row.pending-deletion { opacity: .58; pointer-events: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  .entity-row, .project-block, .navigation-drop-placeholder, .deployment-option, .deployment-slogan-stage blockquote, .research-loading-quote { transition: none !important; animation: none !important; }
  #app-shell.sidebar-motion, .sidebar-motion .sidebar { transition: none !important; }
}

@media (max-width: 1180px) {
  body { min-width: 860px; }
  :root { --sidebar: 245px; }
  .contract-workspace { grid-template-columns: minmax(0,1fr) 8px minmax(285px, 36%); }
  .recent-research-item { grid-template-columns: minmax(170px,.8fr) 88px minmax(220px,1.3fr); }
  .recent-research-time { display: none; }
  .run-progress-shell { grid-template-columns: minmax(220px,1fr) minmax(260px,1.2fr); }
  .run-token-strip { grid-column: 1/-1; }
  .contract-map-nodes { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  body { min-width: 0; }
  #app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: 112px; flex-direction: row; align-items: center; overflow: hidden; }
  .sidebar-motion .sidebar { transition: height 160ms ease-out, padding-block 160ms ease-out, transform 160ms ease-out, visibility 0s; }
  .sidebar-collapsed .sidebar { height: 0; padding-block: 0; transform: translateY(-100%); }
  .sidebar-motion.sidebar-collapsed .sidebar { transition: height 160ms ease-out, padding-block 160ms ease-out, transform 160ms ease-out, visibility 0s 160ms; }
  .sidebar-scroll { display: none; }
  .sidebar .wide { width: auto; }
  .user-card { margin-left: auto; min-width: 220px; }
  .main-shell { min-width: 0; }
  .topbar { position: static; }
  .view { padding: 20px 16px 40px; }
  .page-title-row > span { display: none; }
  .hero-card { min-height: 0; padding: 32px 28px; }
  .hero-card h2 { white-space: normal; }
  .recent-research-item { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .recent-research-progress { grid-column: 1/-1; white-space: normal; }
  .principle-grid { grid-template-columns: 1fr; }
  .conversation-view { height: auto; min-height: calc(100dvh - 86px); overflow: visible; }
  .contract-workspace { display: block; }
  .panel-resizer { display: none; }
  .contract-chat-panel { border-left: 0; border-top: 1px solid var(--line); min-height: 440px; max-height: 72dvh; }
  .contract-map { padding: 19px; }
  .contract-map-heading { align-items: start; flex-direction: column; gap: 7px; }
  .contract-map-heading > p { text-align: left; }
  .contract-map-nodes { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .request-section-grid, .form-grid { grid-template-columns: 1fr; }
  .request-primary { grid-column: auto; }
  .section-editor-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .section-editor-split .panel-resizer { display: none; }
  .run-grid { grid-template-columns: 1fr; }
  .run-grid { grid-template-rows: auto; }
  .graph-card { grid-column: auto; grid-row: auto; }
  .run-progress-shell { grid-template-columns: 1fr; }
  .run-token-strip { grid-column: auto; }
}
@media (max-width: 760px) {
  .research-loading { padding: 30px 20px; }
}
