:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #eef3f2;
  --text: #15201e;
  --muted: #66736f;
  --line: #dbe3e0;
  --teal: #00856f;
  --teal-dark: #006b5b;
  --amber: #b7791f;
  --red: #c2413a;
  --green: #177245;
  --shadow: 0 12px 35px rgba(22, 32, 30, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, label {
  font: inherit;
}
button {
  border: 0;
  cursor: pointer;
}
.app-shell {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #111917;
  color: white;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--teal);
  font-weight: 800;
}
.brand span, .goal-card span, .goal-card small {
  display: block;
  color: #b8c3c0;
  font-size: 12px;
  margin-top: 3px;
}
.nav {
  display: grid;
  gap: 6px;
}
.nav-item {
  height: 42px;
  border-radius: 7px;
  background: transparent;
  color: #d7dfdd;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}
.nav-item svg, button svg, .file-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}
.nav-item.active, .nav-item:hover {
  background: #21302d;
  color: white;
}
.goal-card {
  margin-top: auto;
  background: #1b2724;
  border: 1px solid #2f403c;
  border-radius: 8px;
  padding: 14px;
}
.goal-card strong {
  display: block;
  font-size: 22px;
  margin: 5px 0;
}
.progress {
  margin-top: 12px;
  height: 7px;
  border-radius: 99px;
  background: #31433f;
  overflow: hidden;
}
.progress i {
  display: block;
  width: 1.5%;
  height: 100%;
  background: #23b798;
}
.main {
  padding: 22px;
  overflow: hidden;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
h1, h2, p {
  margin: 0;
}
h1 {
  font-size: 24px;
  line-height: 1.25;
}
h2 {
  font-size: 15px;
  line-height: 1.35;
}
.topbar p, .plain-text {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.65;
}
.top-actions, .button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.primary, .ghost, .icon-button {
  min-height: 38px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  font-size: 13px;
}
.primary {
  background: var(--teal);
  color: white;
}
.primary:hover { background: var(--teal-dark); }
.ghost, .icon-button {
  color: var(--text);
  background: #edf2f1;
  border: 1px solid var(--line);
}
.icon-button {
  width: 36px;
  padding: 0;
}
.file-button input { display: none; }
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-strip div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(22, 32, 30, 0.04);
}
.kpi-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.kpi-strip strong {
  display: block;
  font-size: 23px;
  margin-top: 4px;
}
.view { display: none; }
.view.active { display: block; }
.three-column {
  display: grid;
  grid-template-columns: minmax(250px, 0.92fr) minmax(340px, 1.22fr) minmax(250px, 0.9fr);
  gap: 14px;
  min-height: calc(100vh - 166px);
}
.grid-two {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1.18fr);
  gap: 14px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.message-list, .table-list, .customer-board {
  display: grid;
  gap: 8px;
}
.message-card, .record-card, .customer-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfc;
}
.message-card {
  cursor: pointer;
}
.message-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 133, 111, 0.14);
}
.meta-row, .tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.customer-name {
  font-weight: 700;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.tag {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--surface-2);
  color: #34504a;
}
.tag.hot { background: #e7f7ef; color: var(--green); }
.tag.warn { background: #fff4df; color: var(--amber); }
.tag.risk { background: #ffecea; color: var(--red); }
.message-text {
  margin-top: 8px;
  color: #24312e;
  line-height: 1.55;
  font-size: 13px;
}
textarea, input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  resize: vertical;
  outline: none;
  background: #fff;
  color: var(--text);
}
textarea:focus, input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(0, 133, 111, 0.12);
}
#rawMessage {
  min-height: 96px;
  margin: 12px 0 8px;
}
#draftReply {
  min-height: 210px;
  margin: 8px 0 10px;
}
.full { width: 100%; }
.status {
  font-size: 12px;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--teal-dark);
  background: #e6f6f2;
}
.selected-context, .solution-box, #intelContent, #reportContent {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.62;
  margin-bottom: 12px;
  color: #2a3936;
}
.solution-box { margin-top: 12px; }
.form-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.record-card strong, .customer-card strong {
  display: block;
  margin-bottom: 5px;
}
.record-card p, .customer-card p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}
.checklist {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.connection-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 11px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}
.checklist label {
  display: flex;
  gap: 9px;
  align-items: center;
}
.report-panel {
  min-height: calc(100vh - 166px);
}
.report-block {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.report-block:last-child { border-bottom: 0; }

@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 86px 1fr; }
  .brand div:last-child, .nav-item:not(.active) { font-size: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .goal-card { display: none; }
  .three-column, .grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 10px;
    overflow-x: auto;
  }
  .brand { display: none; }
  .nav {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 48px;
    width: 48px;
    min-width: 48px;
    font-size: 0;
  }
  .nav-item svg { margin: 0; }
  .main { padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 21px; }
}
