:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef3f5;
  --line: #d8e0e5;
  --text: #14232b;
  --muted: #667783;
  --navy: #12313d;
  --blue: #226c8a;
  --green: #2f7d57;
  --amber: #a36a00;
  --red: #a33f35;
  --shadow: 0 18px 48px rgba(20, 35, 43, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

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

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

input,
select,
textarea {
  width: 100%;
  padding: 10px 11px;
  border-radius: 6px;
}

textarea {
  resize: vertical;
}

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: var(--navy);
  color: #e8f1f4;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

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

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

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

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

nav a {
  color: #cddde4;
  padding: 11px 12px;
  border-radius: 6px;
}

nav a.active,
nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.side-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.side-panel span,
.side-panel small {
  display: block;
  color: #b8c9d1;
}

.side-panel strong {
  display: block;
  margin: 8px 0;
  font-size: 24px;
}

.side-guide-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 12px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
}

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

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

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

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

h3 {
  font-size: 15px;
}

h4 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.top-actions,
.data-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.solid-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.solid-button {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.ghost-button,
.icon-button {
  background: #fff;
  color: var(--text);
}

.full {
  width: 100%;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.metric {
  padding: 16px;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 28px;
}

.metric.blue {
  border-top: 4px solid var(--blue);
}

.metric.green {
  border-top: 4px solid var(--green);
}

.metric.amber {
  border-top: 4px solid var(--amber);
}

.metric.slate {
  border-top: 4px solid #546872;
}

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

.panel {
  padding: 16px;
  min-width: 0;
}

.panel.wide {
  grid-column: 1 / -1;
}

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

.panel-head span,
.muted {
  color: var(--muted);
}

.priority-strip {
  height: 210px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  align-items: end;
}

.priority-strip div {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-items: end;
}

.priority-strip i {
  display: block;
  background: var(--blue);
  border-radius: 6px 6px 0 0;
}

.bar-row {
  margin-bottom: 11px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  font-size: 13px;
}

.bar-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.workflow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.workflow div {
  padding: 14px;
  background: var(--surface-2);
  border-radius: 8px;
}

.workflow b,
.workflow strong,
.workflow span {
  display: block;
}

.workflow b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  color: #fff;
  background: var(--navy);
  border-radius: 999px;
}

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

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 14px;
  padding: 24px;
  border: 1px solid rgba(18, 49, 61, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 49, 61, 0.96), rgba(34, 108, 138, 0.9)),
    #12313d;
  color: #fff;
  box-shadow: var(--shadow);
}

.guide-hero span,
.guide-hero p,
.guide-score small,
.guide-score span {
  color: #c8dce4;
}

.guide-hero h2 {
  max-width: 760px;
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1.25;
}

.guide-hero p {
  max-width: 760px;
  margin-bottom: 0;
  line-height: 1.75;
}

.guide-score {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.guide-score strong {
  color: #fff;
  font-size: 44px;
  line-height: 1;
}

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

.guide-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.guide-steps article {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.guide-steps b,
.guide-steps strong,
.guide-steps a {
  display: block;
}

.guide-steps b {
  margin-bottom: 12px;
  color: var(--blue);
  font-size: 12px;
}

.guide-steps p,
.guide-list p {
  color: #2c3d45;
  line-height: 1.65;
}

.guide-steps a {
  margin-top: 12px;
  font-size: 13px;
}

.guide-list p {
  margin-bottom: 10px;
}

.guide-list.compact p {
  margin-bottom: 8px;
}

.quality-stack {
  display: grid;
  gap: 12px;
}

.quality-stack div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.quality-stack span {
  color: var(--muted);
}

.quality-stack i {
  grid-column: 1 / -1;
  display: block;
  height: 8px;
  max-width: 100%;
  border-radius: 999px;
  background: var(--blue);
}

.audit-grid,
.data-roadmap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.audit-grid article,
.data-roadmap div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.audit-grid span,
.audit-grid p,
.data-roadmap span {
  color: var(--muted);
}

.audit-grid span,
.audit-grid strong,
.audit-grid p,
.data-roadmap b,
.data-roadmap strong,
.data-roadmap span {
  display: block;
}

.audit-grid strong {
  margin: 8px 0;
  font-size: 28px;
}

.audit-grid p,
.data-roadmap span {
  margin-bottom: 0;
  line-height: 1.6;
  font-size: 13px;
}

.data-roadmap {
  margin-top: 12px;
}

.data-roadmap b {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
}

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(5, minmax(120px, 1fr)) 72px;
  gap: 10px;
  margin-bottom: 14px;
}

.filters.compact {
  grid-template-columns: 2fr 1fr;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #eaf0f3;
  color: #31434c;
  z-index: 1;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9eef1;
  color: #33464f;
  font-size: 12px;
  white-space: nowrap;
}

.p-A {
  background: #e2f3ea;
  color: var(--green);
}

.p-B {
  background: #e8f2f6;
  color: var(--blue);
}

.p-C,
.amber {
  background: #fff3d8;
  color: var(--amber);
}

.stage {
  background: #eef3f5;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
}

.detail-plan {
  grid-column: 1 / -1;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-title h2 {
  margin: 6px 0;
  font-size: 24px;
}

.back-link {
  font-size: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

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

.info-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.info-grid span,
.info-grid strong {
  display: block;
}

.info-grid span {
  color: var(--muted);
  font-size: 12px;
}

.info-grid strong {
  margin-top: 6px;
}

.text-block {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.text-block p {
  line-height: 1.7;
  color: #2c3d45;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.strategy-grid article,
.strategy-card,
.logistics-card,
.deal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.strategy-grid article {
  padding: 13px;
}

.cards-grid,
.logistics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.strategy-card,
.logistics-card {
  padding: 15px;
}

.strategy-card span,
.logistics-card .muted {
  color: var(--muted);
  font-size: 13px;
}

.strategy-card dl {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.strategy-card dt {
  color: var(--muted);
  font-size: 12px;
}

.strategy-card dd {
  margin: -4px 0 6px;
  line-height: 1.55;
}

.logistics-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.logistics-card p {
  line-height: 1.55;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.lane {
  min-height: 380px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.lane h3 {
  display: flex;
  justify-content: space-between;
  margin: 4px 4px 10px;
}

.deal-card {
  display: block;
  padding: 12px;
  margin-bottom: 8px;
  color: var(--text);
}

.deal-card strong,
.deal-card span,
.deal-card small {
  display: block;
}

.deal-card span,
.deal-card small {
  margin-top: 5px;
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 10px;
}

.file-list a {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.agent-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  width: min(460px, calc(100vw - 32px));
  color: var(--text);
}

.agent-widget.expanded {
  top: 22px;
}

.agent-toggle {
  width: 100%;
  min-height: 46px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid rgba(18, 49, 61, 0.2);
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 18px 46px rgba(20, 35, 43, 0.22);
  cursor: pointer;
}

.agent-toggle span,
.agent-toggle strong {
  white-space: nowrap;
}

.agent-toggle strong {
  font-size: 13px;
  font-weight: 600;
  color: #d7e8ee;
}

.agent-panel {
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(18, 49, 61, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(20, 35, 43, 0.22);
}

.agent-widget.collapsed {
  width: 220px;
}

.agent-widget.collapsed .agent-toggle {
  display: flex;
}

.agent-widget.collapsed .agent-panel {
  display: none;
}

.agent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  background: var(--navy);
  color: #fff;
}

.agent-header p {
  margin: 0 0 4px;
  color: #b8c9d1;
  font-size: 12px;
}

.agent-header h2 {
  margin: 0;
  font-size: 18px;
}

.agent-collapse {
  width: 34px;
  height: 34px;
  border-color: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.agent-context {
  flex: 0 0 auto;
  max-height: min(38vh, 330px);
  overflow: auto;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
}

.agent-context label {
  margin-bottom: 9px;
}

.agent-context select {
  max-width: 100%;
}

.agent-customer-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agent-customer-card strong,
.agent-customer-card span {
  display: block;
}

.agent-customer-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.agent-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.agent-chip {
  max-width: 100%;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #d6e1e6;
  border-radius: 999px;
  background: #fff;
  color: #27434e;
  cursor: pointer;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-chip:hover {
  border-color: rgba(34, 108, 138, 0.45);
  background: #eef7fa;
}

.agent-messages {
  flex: 1 1 auto;
  height: auto;
  min-height: 260px;
  overflow: auto;
  padding: 14px;
  background: #fbfcfd;
}

.agent-empty {
  padding: 14px;
  border: 1px dashed #c8d3d9;
  border-radius: 8px;
  background: #fff;
}

.agent-empty strong,
.agent-empty span {
  display: block;
}

.agent-empty span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.agent-message {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.agent-message > span {
  color: var(--muted);
  font-size: 12px;
}

.agent-message .agent-md {
  max-width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.agent-message.user {
  justify-items: end;
}

.agent-message.user .agent-md {
  max-width: 88%;
  border-color: rgba(34, 108, 138, 0.25);
  background: #e9f4f8;
}

.agent-md h3,
.agent-md h4,
.agent-md h5,
.agent-md h6 {
  margin: 8px 0 7px;
  color: #122b35;
  font-size: 15px;
}

.agent-md p,
.agent-md ul {
  margin: 0 0 9px;
}

.agent-md p:last-child,
.agent-md ul:last-child {
  margin-bottom: 0;
}

.agent-md ul {
  padding-left: 20px;
}

.agent-md li {
  margin-bottom: 5px;
}

.agent-md code {
  padding: 1px 5px;
  border-radius: 5px;
  background: #eef3f5;
  color: #16333e;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
}

.agent-md pre {
  max-width: 100%;
  overflow: auto;
  margin: 10px 0;
  padding: 11px;
  border-radius: 8px;
  background: #10252d;
  color: #e9f4f7;
}

.agent-md pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.agent-md a {
  word-break: break-all;
}

.agent-md-table-wrap {
  max-width: 100%;
  overflow: auto;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agent-md table {
  min-width: 0;
  font-size: 12px;
}

.agent-md th,
.agent-md td {
  padding: 8px;
}

.agent-md th {
  position: static;
}

.agent-status-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.agent-status-row span {
  min-width: 150px;
  margin-right: auto;
}

.agent-text-button {
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.agent-text-button:disabled {
  color: #9ba8af;
  cursor: not-allowed;
}

.agent-form {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.agent-form textarea {
  min-height: 70px;
  max-height: 140px;
}

@media (max-width: 1200px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .workflow,
  .strategy-grid,
  .guide-steps,
  .audit-grid,
  .data-roadmap {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  #app {
    grid-template-columns: 1fr;
  }

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

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

  .topbar,
  .detail-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics-grid,
  .dashboard-grid,
  .detail-layout,
  .cards-grid,
  .logistics-grid,
  .kanban,
  .filters,
  .filters.compact,
  .info-grid,
  .strategy-grid,
  .workflow,
  .guide-hero,
  .guide-grid,
  .guide-steps,
  .audit-grid,
  .data-roadmap {
    grid-template-columns: 1fr;
  }

  .guide-hero h2 {
    font-size: 23px;
  }

  .agent-widget {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .agent-widget.expanded {
    top: 12px;
  }

  .agent-messages {
    height: calc(100vh - 380px);
    min-height: 180px;
  }

  .agent-form {
    grid-template-columns: 1fr;
  }

  .agent-message.user .agent-md {
    max-width: 100%;
  }
}
