:root {
  color-scheme: dark;
  --gold: #C9A84C;
  --gold-light: #E8C97A;
  --gold-dim: #8B6914;
  --gold-soft: rgba(201, 168, 76, 0.10);
  --navy-950: #07111f;
  --navy-900: #0A1628;
  --navy-850: #0d1e38;
  --navy-800: #112240;
  --navy-700: #1E3A5F;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: rgba(255, 255, 255, 0.065);
  --surface-warm: rgba(201, 168, 76, 0.035);
  --line: rgba(201, 168, 76, 0.16);
  --line-subtle: rgba(255, 255, 255, 0.075);
  --text: #F8F5F0;
  --text-soft: #D7DFEA;
  --muted: #A8B2C4;
  --muted-2: #7A8FA8;
  --danger: #E87070;
  --danger-bg: rgba(192, 57, 43, 0.14);
  --success: #5DBE80;
  --success-bg: rgba(39, 174, 96, 0.15);
  --warning: #E8C84A;
  --warning-bg: rgba(212, 172, 13, 0.14);
  --blue: #70B8E8;
  --blue-bg: rgba(41, 128, 185, 0.14);
  --radius: 8px;
  --shadow-soft: 0 24px 70px rgba(0, 0, 0, 0.22);
  --shadow-card: 0 14px 38px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background:
    radial-gradient(ellipse at 82% 10%, rgba(201, 168, 76, 0.10), transparent 34%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-900) 46%, var(--navy-850) 100%);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 168, 76, 0.36); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201, 168, 76, 0.58); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(201, 168, 76, 0.07), transparent 32%),
    var(--navy-800);
  color: var(--text);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-top: 2px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 5px;
  background: rgba(248, 245, 240, 0.96);
  border: 1px solid rgba(201, 168, 76, 0.26);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand strong,
.brand span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.brand strong {
  letter-spacing: 0.04em;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.brand span { margin-top: 3px; font-size: 12px; color: var(--muted); }

nav { display: grid; gap: 6px; }

.nav-item {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  transition: 0.2s ease;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(201, 168, 76, 0.10);
  border-color: rgba(201, 168, 76, 0.28);
  color: var(--gold-light);
}

.sidebar-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.sidebar-note span {
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--gold-light);
  font-weight: 700;
}
.sidebar-note p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.8;
  color: #cbd7e6;
}

.shell {
  min-width: 0;
  min-height: 100vh;
  padding: 20px 24px;
}

.topbar {
  min-height: 178px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, rgba(10, 22, 40, 0.98), rgba(17, 34, 64, 0.95)),
    radial-gradient(ellipse at 80% 36%, rgba(201, 168, 76, 0.18), transparent 42%);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 28px;
  bottom: 0;
  width: 170px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

h1, h2, h3, p { margin-top: 0; }

.eyebrow {
  margin-bottom: 9px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.055em;
  line-height: 1.6;
}

h1 {
  margin-bottom: 10px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: 0.01em;
  color: var(--text);
}

.topbar p,
.form-layout > div p {
  color: var(--muted);
  line-height: 1.78;
  margin-bottom: 0;
  max-width: 760px;
}

.topbar-actions,
.form-actions { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }

.primary-button,
.secondary-button,
.icon-button {
  border-radius: 5px;
  min-height: 38px;
  padding: 0 16px;
  cursor: pointer;
  transition: 0.18s ease;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dim));
  color: var(--navy-950);
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 24px rgba(201, 168, 76, 0.28);
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(201, 168, 76, 0.36); }

.secondary-button,
.icon-button {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: var(--text-soft);
}
.secondary-button:hover,
.icon-button:hover { border-color: var(--gold); color: var(--gold-light); }
.icon-button { width: 38px; padding: 0; font-size: 18px; display: grid; place-items: center; }

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 18px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.026);
  overflow: hidden;
}

.insight-card {
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 16px 20px;
  box-shadow: none;
}
.insight-card:last-child { border-right: 0; }
.insight-card span,
.insight-card em { display: block; color: var(--muted-2); font-style: normal; font-size: 12px; }
.insight-card strong { display: block; margin: 5px 0 4px; color: var(--gold-light); font-size: 25px; line-height: 1; }

.view { display: none; }
.active-view { display: block; }

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px 140px;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

label { display: grid; gap: 6px; color: var(--muted-2); font-size: 12px; letter-spacing: 0.04em; }

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

input::placeholder,
textarea::placeholder { color: rgba(168, 178, 196, 0.62); }
select option { background: var(--navy-800); color: var(--text); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 16px;
  min-height: calc(100vh - 338px);
}

.project-list-panel,
.detail-panel,
.form-layout {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.project-list-panel { overflow: hidden; }

.panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.055), transparent);
}
.panel-header h2 {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}
.panel-header span { color: var(--gold-dim); font-size: 13px; }

.project-list { max-height: calc(100vh - 398px); overflow: auto; }

.project-card {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  background: transparent;
  color: inherit;
  display: grid;
  gap: 9px;
  padding: 15px 17px;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: 0.18s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: transparent;
  transition: 0.18s ease;
}
.project-card:hover { background: rgba(255, 255, 255, 0.04); }
.project-card.active { background: rgba(201, 168, 76, 0.075); }
.project-card.active::before { background: var(--gold); }
.project-card h3 {
  margin: 0;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  font-weight: 700;
}

.meta-row,
.tag-row,
.score-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted-2);
  font-size: 12px;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge.rating-a { background: var(--success-bg); color: var(--success); border-color: rgba(39, 174, 96, 0.26); }
.badge.rating-b { background: var(--blue-bg); color: var(--blue); border-color: rgba(41, 128, 185, 0.28); }
.badge.rating-c { background: var(--warning-bg); color: var(--warning); border-color: rgba(212, 172, 13, 0.28); }
.badge.rating-d { background: var(--danger-bg); color: var(--danger); border-color: rgba(192, 57, 43, 0.28); }
.tag { background: rgba(201, 168, 76, 0.10); color: var(--gold-light); border-color: rgba(201, 168, 76, 0.22); }

.detail-panel { padding: 20px; overflow: auto; }
.empty-state {
  height: 100%;
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(201, 168, 76, 0.20);
  border-radius: var(--radius);
  background: rgba(201, 168, 76, 0.025);
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.detail-head h2 {
  margin-bottom: 8px;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.info-section {
  border: 1px solid rgba(201, 168, 76, 0.11);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.027);
}
.info-section.full { grid-column: 1 / -1; }
.info-section h3 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--gold-light);
  font-weight: 700;
  letter-spacing: 0.03em;
}
.subhead { margin-top: 18px; }
.info-section p,
.info-list li { color: var(--text-soft); line-height: 1.72; }
.info-list { margin: 0; padding-left: 18px; }

.kv-grid { display: grid; gap: 10px; }
.kv-row { display: grid; grid-template-columns: 112px 1fr; gap: 10px; color: var(--text-soft); line-height: 1.58; }
.kv-row span:first-child { color: var(--muted-2); }
.kv-row strong { color: var(--gold-light); }

.timeline { display: grid; gap: 10px; }
.timeline-item { border-left: 3px solid var(--gold); padding-left: 12px; }
.timeline-item strong { display: block; margin-bottom: 4px; color: var(--text); }
.timeline-item p { margin-bottom: 0; }
.muted { color: var(--muted); }

.inline-form { display: grid; gap: 10px; margin-top: 14px; }
.inline-form button { justify-self: start; }

.form-layout {
  max-width: 980px;
  padding: 24px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}
.form-layout h2 {
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-weight: 800;
  color: var(--text);
}
.project-form { display: grid; gap: 14px; }

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-title-row h3 { margin-bottom: 0; }

.compact-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none !important;
  box-shadow: none !important;
}

.notice-text {
  margin: -2px 0 12px;
  padding: 9px 11px;
  border: 1px solid rgba(212, 172, 13, 0.28);
  border-radius: 6px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
  line-height: 1.55;
}

.agent-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(7, 17, 31, 0.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.agent-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.agent-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  width: min(520px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-900);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.22s ease;
}
.agent-drawer.active { transform: translateX(0); }

.agent-drawer-head {
  min-height: 64px;
  padding: 12px 14px 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-subtle);
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.08), rgba(255, 255, 255, 0.02));
}
.agent-drawer-head span {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}
.agent-drawer-head strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
}
.agent-drawer iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.agent-drawer-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--line-subtle);
  background: rgba(255, 255, 255, 0.035);
  text-align: right;
}
.agent-drawer-foot a {
  color: var(--gold-light);
  font-size: 13px;
  text-decoration: none;
}
.agent-drawer-foot a:hover { text-decoration: underline; }

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .workspace-grid,
  .form-layout,
  .section-grid,
  .toolbar,
  .insight-strip { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .topbar-actions { flex-wrap: wrap; }
  .detail-head { flex-direction: column; }
  .detail-actions { justify-content: flex-start; }
  .project-list { max-height: none; }
  .agent-drawer {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}
