:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #e4e7ec;
  --blue: #2563eb;
  --blue-dark: #12325f;
  --teal: #14b8a6;
  --amber: #f59e0b;
  --purple: #7c3aed;
  --red: #ef4444;
  --green: #16a34a;
  --shadow: 0 14px 36px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: #101827;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #b7c2d7;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #dbe4f4;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #1f3f85;
  color: #ffffff;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

.nav-item.active .nav-dot {
  background: #38bdf8;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
}

.sidebar-footer span,
.sidebar-footer strong {
  display: block;
}

.sidebar-footer span {
  color: #9fb0c8;
  font-size: 12px;
}

.sidebar-footer strong {
  margin-top: 6px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

.topbar-actions,
.filter-row,
.form-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  width: 320px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
}

.primary-button,
.ghost-button,
.link-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: #344054;
}

.link-button {
  height: auto;
  padding: 0;
  color: var(--blue);
  background: transparent;
}

.small-button {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.icon-button {
  width: 34px;
  height: 34px;
  padding: 0;
  background: #f2f4f7;
  color: #475467;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 112px;
  padding: 18px;
}

.metric-card span,
.metric-card em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 30px;
}

.danger-text {
  color: var(--red);
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.funnel-wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: center;
}

.funnel {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.funnel div {
  width: var(--w);
  height: 46px;
  border-radius: 8px;
  padding: 0 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  background: var(--c);
}

.stage-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stage-list div,
.analysis-grid div,
.info-grid div,
.context-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.stage-list strong,
.stage-list span,
.analysis-grid span,
.analysis-grid b,
.info-grid span,
.info-grid b,
.context-summary span,
.context-summary b {
  display: block;
}

.stage-list span,
.analysis-grid span,
.info-grid span,
.context-summary span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.alert-list,
.timeline,
.quote-list,
.review-list,
.action-list {
  display: grid;
  gap: 10px;
}

.alert-list article,
.timeline div,
.quote-list div,
.review-list div,
.round-list div,
.action-list div {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcff;
}

.alert-list b,
.alert-list span,
.quote-list b,
.quote-list span,
.review-list b,
.review-list span,
.round-list b,
.round-list span,
.action-list b,
.action-list span {
  display: block;
}

.alert-list span,
.quote-list span,
.review-list span,
.round-list span,
.action-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.timeline time {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 12px;
}

.timeline p {
  margin-bottom: 0;
}

.bars {
  display: grid;
  gap: 13px;
}

.bars div {
  display: grid;
  grid-template-columns: 130px 1fr 34px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.bars b {
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  width: var(--bar);
}

.bars em {
  font-style: normal;
  color: var(--text);
  text-align: right;
}

.content-split {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
}

select,
textarea,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

select,
input {
  height: 38px;
  padding: 0 10px;
}

textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px;
  resize: vertical;
  line-height: 1.6;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: #f9fafb;
  font-weight: 600;
}

.data-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-style: normal;
  background: #eef2ff;
  color: var(--blue);
}

.tag.blue {
  background: #eff6ff;
  color: #1d4ed8;
}

.tag.green {
  background: #ecfdf3;
  color: #067647;
}

.tag.amber {
  background: #fffaeb;
  color: #b54708;
}

.tag.purple {
  background: #f4f3ff;
  color: #6d28d9;
}

.customer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
}

.customer-head h2 {
  margin-bottom: 4px;
}

.customer-head span {
  color: var(--muted);
  font-size: 13px;
}

.info-grid,
.analysis-grid,
.context-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.section-title {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.chip-cloud,
.select-chips,
.scenario-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-cloud span,
.select-chips button,
.scenario-grid button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #344054;
  font-size: 13px;
}

.select-chips button.selected,
.scenario-grid button:hover,
.chip-cloud.editable span {
  border-color: var(--blue);
  background: #eff6ff;
  color: #1d4ed8;
}

.duplicate-panel {
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

.duplicate-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: center;
}

.duplicate-row b,
.duplicate-row span {
  display: block;
}

.duplicate-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 480px;
  gap: 16px;
}

.follow-form {
  display: grid;
  gap: 14px;
}

.follow-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.analysis-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  margin-bottom: 12px;
}

.analysis-block span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.analysis-block p {
  margin-bottom: 0;
  line-height: 1.7;
}

.ai-result-card {
  align-self: start;
}

.button-row {
  flex-wrap: wrap;
  margin-top: 16px;
}

.ai-layout {
  grid-template-columns: 1fr 1fr;
}

.code-block {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #d0d5dd;
  background: #111827;
  color: #e5e7eb;
  overflow: auto;
  line-height: 1.55;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.scenario-grid button {
  height: 46px;
  border-radius: 8px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.task-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.task-card b,
.task-card span {
  display: block;
}

.task-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.task-card.warn {
  border-color: #fedf89;
  background: #fffcf5;
}

.task-card.danger {
  border-color: #fecdca;
  background: #fff5f6;
}

.product-table td:nth-child(2) {
  font-weight: 800;
}

.delivery-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.delivery-steps div {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f9fafb;
}

.delivery-steps .done {
  color: #067647;
  border-color: #abefc6;
  background: #ecfdf3;
}

.delivery-steps .active {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.config-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}

.setup-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.setup-list li {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fbfcff;
}

.setup-list li.done {
  color: #067647;
  border-color: #abefc6;
  background: #ecfdf3;
}

.setup-list li.active {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.tab-buttons {
  display: flex;
  gap: 8px;
}

.tab-buttons button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--muted);
}

.tab-buttons button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.config-tab {
  display: none;
}

.config-tab.active {
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.42);
}

.modal {
  width: 620px;
  max-width: calc(100vw - 48px);
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.modal p {
  line-height: 1.7;
  color: #475467;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: #101827;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .metric-grid,
  .dashboard-layout,
  .two-column,
  .content-split,
  .workbench-grid,
  .kanban,
  .config-layout {
    display: grid;
    grid-template-columns: 1fr;
    height: auto;
  }

  .search-box {
    width: 100%;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .data-table {
    min-width: 720px;
  }

  .panel {
    overflow-x: auto;
  }

  .scenario-grid {
    grid-template-columns: 1fr 1fr;
  }
}
