:root {
  --bg: #0a0b0d;
  --panel: #101216;
  --panel2: #14171c;
  --panel3: #191d23;
  --line: #242932;
  --line2: #303641;
  --text: #f2f4f7;
  --muted: #8d95a3;
  --muted2: #626b79;
  --accent: #e8eaed;
  --good: #73d39d;
  --bad: #ff7d7d;
  --warn: #e5c77a;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; }
button, select, textarea, input { font: inherit; }
button { cursor: pointer; }
.app-shell { display: grid; grid-template-columns: 54px 270px 1fr; width: 100vw; height: 100vh; }
.rail { border-right: 1px solid var(--line); background: #090a0c; display: flex; flex-direction: column; align-items: center; padding: 11px 8px; gap: 9px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #3a404b; border-radius: 9px; font-weight: 900; letter-spacing: -.5px; background: linear-gradient(145deg,#1b1f26,#0e1014); margin-bottom: 12px; }
.rail-btn { width: 34px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 18px; }
.rail-btn:hover, .rail-btn.active { color: white; background: #181b20; }
.rail-spacer { flex: 1; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted2); box-shadow: 0 0 0 4px #15181d; }
.status-dot.ok { background: var(--good); }
.status-dot.bad { background: var(--bad); }
.sidebar { min-width: 0; border-right: 1px solid var(--line); background: #0d0f12; display: flex; flex-direction: column; }
.sidebar-head { min-height: 75px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 16px; }
.eyebrow { color: var(--muted2); font-size: 9px; letter-spacing: 2px; font-weight: 800; }
.sidebar-head h1 { font-size: 17px; margin: 3px 0 0; letter-spacing: -.3px; }
.icon-btn { border: 1px solid var(--line2); background: #15181d; color: white; width: 30px; height: 30px; border-radius: 8px; font-size: 19px; line-height: 1; }
.icon-btn:hover { background: #1d2128; }
.section-label { padding: 14px 13px 8px; color: var(--muted2); text-transform: uppercase; font-size: 9px; letter-spacing: 1.4px; font-weight: 800; }
.row-label { display: flex; align-items: center; justify-content: space-between; }
.project-list { padding: 0 7px; max-height: 168px; overflow: auto; }
.project-item { display: flex; gap: 9px; align-items: center; width: 100%; padding: 8px 9px; border-radius: 8px; color: #b7bdc7; border: 1px solid transparent; background: transparent; text-align: left; }
.project-item:hover { background: #14171b; color: white; }
.project-item.active { background: #181c22; border-color: #252b34; color: white; }
.project-glyph { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #2b3038; border-radius: 6px; font-size: 11px; color: #a6adb8; }
.project-info { min-width: 0; flex: 1; }
.project-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.project-date { font-size: 9px; color: var(--muted2); margin-top: 2px; }
.tree { flex: 1; overflow: auto; padding: 0 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.tree-row { display: flex; align-items: center; gap: 6px; min-height: 25px; padding: 3px 7px; border-radius: 6px; color: #9ea6b2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.tree-row:hover { background: #15191e; color: white; }
.tree-row.selected { background: #1b2027; color: white; }
.tree-row.dir { color: #bcc3cd; }
.empty-state { color: var(--muted2); font-family: inherit; font-size: 11px; padding: 13px; }
.sidebar-footer { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; }
.model-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; }
.model-line select { min-width: 0; width: 160px; color: #cbd0d7; background: #12151a; border: 1px solid var(--line); border-radius: 7px; padding: 5px 7px; outline: none; }
.muted { color: var(--muted2); }
.workspace { min-width: 0; display: flex; flex-direction: column; background: #0a0c0f; }
.topbar { min-height: 75px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 13px 18px; background: rgba(12,14,17,.95); }
.workspace-title { font-size: 14px; font-weight: 700; }
.workspace-meta { margin-top: 3px; font-size: 10px; color: var(--muted2); }
.top-actions { display: flex; gap: 8px; }
.ghost-btn, .primary-btn { border-radius: 8px; padding: 8px 11px; font-size: 11px; font-weight: 650; }
.ghost-btn { background: #12151a; color: #c7ccd4; border: 1px solid var(--line2); }
.ghost-btn:hover:not(:disabled) { background: #191d23; color: white; }
.primary-btn { border: 1px solid #e5e7eb; background: #eceff2; color: #111318; }
.primary-btn:hover:not(:disabled) { background: white; }
button:disabled { opacity: .35; cursor: not-allowed; }
.content-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(420px, 1.22fr) minmax(360px, .78fr); }
.editor-pane { min-width: 0; min-height: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: #0d0f12; }
.editor-tabs { height: 40px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 10px; background: #0c0e11; }
.file-tab { font-size: 11px; color: #b4bbc6; padding: 8px 9px; border-bottom: 1px solid #d8dce2; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiny-btn { border: 0; background: transparent; color: var(--muted2); font-size: 9px; padding: 4px; }
.tiny-btn:hover:not(:disabled) { color: white; }
.welcome-panel { flex: 1; min-height: 0; overflow: auto; padding: clamp(28px, 5vw, 70px); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.hero-badge { font-size: 9px; letter-spacing: 1.8px; border: 1px solid #303641; color: #aeb6c2; border-radius: 999px; padding: 6px 9px; font-weight: 800; }
.welcome-panel h2, .chat-center h2 { margin: 16px 0 10px; font-size: clamp(28px, 3vw, 44px); letter-spacing: -1.8px; line-height: 1.05; max-width: 660px; }
.welcome-panel > p, .chat-center > p { color: var(--muted); max-width: 650px; font-size: 13px; line-height: 1.7; }
.cap-grid { width: min(720px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 21px 0 16px; }
.cap-card { border: 1px solid var(--line); background: #111419; border-radius: 10px; padding: 13px; display: flex; flex-direction: column; gap: 5px; }
.cap-card b { font-size: 11px; }
.cap-card span { color: var(--muted2); font-size: 9px; }
.drop-zone { width: min(720px, 100%); min-height: 112px; border: 1px dashed #3a414c; border-radius: 12px; background: #101318; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; transition: .15s ease; }
.drop-zone:hover, .drop-zone.drag { border-color: #707886; background: #14181e; }
.drop-icon { font-size: 19px; color: #aab2bd; }
.drop-zone strong { font-size: 11px; }
.drop-zone span { color: var(--muted2); font-size: 9px; }
.code-view { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 22px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11px; line-height: 1.65; color: #ccd2da; white-space: pre; tab-size: 2; }
.hidden { display: none !important; }
.agent-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0b0d10; }
.agent-head { height: 54px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: 9px 13px; }
.agent-title { font-size: 12px; font-weight: 750; }
.agent-sub { color: var(--muted2); font-size: 9px; margin-top: 2px; }
.mode-toggle { display: inline-flex; padding: 2px; background: #111419; border: 1px solid var(--line); border-radius: 8px; }
.mode-btn { border: 0; padding: 5px 8px; border-radius: 6px; color: var(--muted2); background: transparent; font-size: 9px; }
.mode-btn.active { background: #20252c; color: white; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 15px; }
.message { margin-bottom: 15px; }
.message-role { color: var(--muted2); font-size: 8px; letter-spacing: 1px; font-weight: 800; margin-bottom: 5px; text-transform: uppercase; }
.message-body { font-size: 11px; line-height: 1.7; color: #c5cbd4; word-break: break-word; }
.user-message .message-body { border-left: 2px solid #444b57; padding-left: 10px; color: white; }
.message-body pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #11151a; border: 1px solid var(--line); padding: 9px; border-radius: 7px; }
.agent-trace { max-height: 105px; overflow: auto; border-top: 1px solid var(--line); padding: 7px 13px; background: #0f1216; font-size: 9px; color: var(--muted); }
.trace-row { display: flex; gap: 7px; padding: 2px 0; }
.trace-ok { color: var(--good); } .trace-bad { color: var(--bad); }
.composer-wrap { border-top: 1px solid var(--line); padding: 10px; background: #0d0f12; }
.quick-prompts { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 7px; }
.quick-prompts button { white-space: nowrap; border: 1px solid var(--line); background: #111419; color: #8f97a3; border-radius: 999px; padding: 5px 8px; font-size: 8px; }
.quick-prompts button:hover { color: white; border-color: #3a414b; }
.composer { border: 1px solid #2b313a; border-radius: 10px; background: #12151a; display: flex; align-items: flex-end; padding: 7px; gap: 7px; }
.composer textarea { flex: 1; resize: none; max-height: 160px; min-height: 38px; border: 0; outline: 0; color: white; background: transparent; font-size: 11px; line-height: 1.5; padding: 6px; }
.composer textarea::placeholder { color: #5d6572; }
.send-btn { min-width: 52px; height: 34px; border: 1px solid #d8dce2; background: #e8ebef; color: #121419; border-radius: 8px; font-size: 10px; font-weight: 800; }
.send-btn.busy { opacity: .6; }
.composer-note { color: #535c69; font-size: 8px; padding: 6px 2px 0; }
.chat-only { flex: 1; overflow: auto; padding: 50px 8vw; }
.chat-center { width: min(850px, 100%); margin: 0 auto; }
.plain-messages { margin: 25px 0; display: grid; gap: 12px; }
.standalone { position: sticky; bottom: 20px; box-shadow: 0 16px 60px #0008; }
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 20; }
.modal-card { width: min(560px, 92vw); max-height: 70vh; overflow: hidden; background: #111419; border: 1px solid #303640; border-radius: 12px; box-shadow: 0 30px 90px #000a; }
.modal-head { padding: 13px 14px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); font-size: 11px; }
.modal-body { padding: 12px; overflow: auto; max-height: 58vh; }
.snapshot-row { display: flex; align-items: center; justify-content: space-between; padding: 9px; border-bottom: 1px solid #20252c; gap: 10px; font-size: 10px; color: #b4bbc5; }
.snapshot-row button { border: 1px solid var(--line2); background: #171a20; color: #d3d7dd; border-radius: 6px; font-size: 9px; padding: 5px 7px; }
.check-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-bottom: 12px; }
.check-card { background: #161a20; border: 1px solid var(--line); border-radius: 8px; padding: 9px; }
.check-card b { display: block; font-size: 17px; } .check-card span { font-size: 8px; color: var(--muted2); }
.finding { padding: 8px 0; border-bottom: 1px solid #22272f; font-size: 9px; line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 15px); opacity: 0; pointer-events: none; background: #e9ecf0; color: #111318; border-radius: 8px; padding: 8px 12px; font-size: 10px; font-weight: 700; transition: .18s ease; z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%,0); }
.toast.error { background: #ff8e8e; }
@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 50px 220px 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .editor-pane { display: none; }
}
@media (max-width: 720px) {
  .app-shell { grid-template-columns: 48px 1fr; }
  .sidebar { display: none; }
  .top-actions .ghost-btn { display: none; }
}

/* V5 OpenAI Agent Workflow */
.team-status { border: 1px solid var(--line); background: #101318; border-radius: 9px; padding: 8px; display: grid; gap: 4px; }
.team-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.team-title span { font-size: 8px; letter-spacing: 1.4px; font-weight: 850; color: #b9c0ca; }
.team-title em { font-style: normal; font-size: 7px; color: var(--muted2); }
.team-role { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 8px; color: var(--muted2); text-transform: uppercase; }
.team-role b { font-size: 7px; letter-spacing: .5px; border: 1px solid #29303a; border-radius: 999px; padding: 2px 5px; color: #aeb6c2; font-weight: 700; }
.team-role b.native { color: var(--good); border-color: #28523a; }
.team-role b.fallback { color: var(--warn); border-color: #51472b; }
.single-mode .single-model-line { opacity: 1; }
body:not(.single-mode) .single-model-line { opacity: .45; }
.team-run { color: #c8ced7; border-bottom: 1px dotted #262c34; padding: 3px 0; }
.team-run > span:first-child { color: var(--warn); }
.chat-provider-row { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted2); font-size: 9px; }
.chat-provider-row select { background: #111419; color: #cdd2da; border: 1px solid var(--line2); border-radius: 7px; padding: 5px 8px; font-size: 9px; }

/* V5 OpenAI Project Intelligence */
.profile-block { padding: 11px 0; border-bottom: 1px solid #22272f; }
.profile-block > b { display: block; margin-bottom: 8px; font-size: 9px; letter-spacing: .8px; color: #aeb6c2; text-transform: uppercase; }
.profile-block > div { display: flex; flex-wrap: wrap; gap: 5px; }
.profile-pill { display: inline-flex; border: 1px solid #303741; background: #15191f; color: #c6ccd5; border-radius: 999px; padding: 4px 7px; font-size: 8px; }
.team-role b { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* V5 Universe Project Intelligence */
.modal-card.wide, .modal-card:has(.nui-preview-frame), .modal-card:has(.nui-review-grid) { width: min(1040px, 94vw); max-height: 86vh; }
.modal-body:has(.nui-preview-frame), .modal-body:has(.nui-review-grid) { max-height: 76vh; }
.intel-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin-bottom:12px; }
.intel-card { border:1px solid var(--line); background:#15191f; border-radius:8px; padding:10px; }
.intel-card b { display:block; font-size:16px; }
.intel-card span { color:var(--muted2); font-size:8px; }
.intel-list { margin-top:10px; border-top:1px solid var(--line); }
.intel-row { display:grid; grid-template-columns:110px 1fr 70px; gap:8px; padding:7px 0; border-bottom:1px solid #20252c; font-size:9px; }
.intel-row code { color:#cbd2dc; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.nui-preview-frame { width:100%; height:min(650px,66vh); border:1px solid #303741; border-radius:9px; background:#07090b; }
.nui-review-grid { display:grid; grid-template-columns:minmax(320px,1.15fr) minmax(280px,.85fr); gap:12px; align-items:start; }
.nui-review-shot { width:100%; display:block; border:1px solid #303741; border-radius:9px; background:#07090b; }
.nui-review-copy { font-size:10px; line-height:1.7; color:#c5cbd4; }
.source-chip { display:inline-flex; margin:2px 3px 2px 0; padding:3px 6px; border:1px solid #29313a; border-radius:999px; font-size:7px; color:#8fa0b2; }
@media(max-width:820px){.nui-review-grid{grid-template-columns:1fr}.intel-grid{grid-template-columns:repeat(2,1fr)}}

/* V5 LEIGONG Brand + Integration */
.brand-mark{overflow:hidden;padding:0!important;background:#07090c!important;border-color:#263449!important}
.brand-mark img{width:100%;height:100%;object-fit:contain;display:block;border-radius:inherit}
.brand-lockup{display:flex;align-items:center;gap:9px}
.brand-lockup img{width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid #33455f;box-shadow:0 0 18px #6aa9ff22}
.integration-resource{border:1px solid var(--line);background:#14181e;border-radius:9px;padding:10px;margin:7px 0}
.integration-resource h4{margin:0 0 7px;font-size:10px;color:#e0e5ec}
.integration-meta{display:flex;flex-wrap:wrap;gap:5px;font-size:8px;color:var(--muted2)}
.design-brand-card{display:grid;grid-template-columns:88px 1fr;gap:12px;align-items:center;border:1px solid #2d3949;background:#10151c;border-radius:10px;padding:11px}
.design-brand-card img{width:88px;height:88px;border-radius:50%;object-fit:contain;border:1px solid #425b7a}
.license-row{display:grid;grid-template-columns:130px 1fr;gap:8px;padding:7px 0;border-bottom:1px solid #222933;font-size:9px}
