:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #d9e0ea;
  --text: #202938;
  --muted: #657386;
  --nav: #122033;
  --blue: #1f5fbf;
  --green: #0e8f67;
  --amber: #a96d12;
  --red: #c43c32;
  --shadow: 0 12px 28px rgba(25, 35, 50, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button,
a {
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  background: var(--nav);
  color: #f7fafc;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: #2f7ed8;
  font-weight: 800;
}

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

.brand span {
  margin-top: 4px;
  color: #b8c4d5;
  font-size: 12px;
  line-height: 1.5;
}

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

nav button {
  height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #d8e0ea;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

nav button.active,
nav button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.status-block {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.status-block span,
.status-block small,
.metrics span,
.list-item span,
.social-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-block strong {
  display: block;
  margin: 6px 0 0;
}

.status-block strong + strong {
  margin-top: 8px;
  color: #aee8c9;
  font-size: 13px;
}

.main {
  padding: 28px;
}

.topbar,
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  align-items: center;
  margin-bottom: 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

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

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
}

h3 {
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.45;
}

p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.55;
}

.ghost-button,
.primary-button,
.panel button,
.list-item button {
  height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-button {
  color: var(--blue);
  background: #eef5ff;
  border: 1px solid #bdd4f6;
}

.primary-button,
.panel button {
  color: #ffffff;
  background: var(--blue);
  border: 1px solid var(--blue);
  font-weight: 700;
}

.control-grid,
.workspace-grid,
.crm-grid {
  display: grid;
  gap: 18px;
}

.control-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  margin-bottom: 18px;
}

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

.lower-grid {
  align-items: start;
}

.crm-panel {
  margin-bottom: 18px;
  border-color: #b8d4c4;
  background:
    linear-gradient(135deg, rgba(14, 143, 103, 0.08), rgba(31, 95, 191, 0.06)),
    #ffffff;
}

.crm-workspace-panel {
  scroll-margin-top: 18px;
}

.crm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--green);
  border-radius: 7px;
  color: #ffffff;
  background: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.primary-link.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

.crm-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.crm-card {
  padding: 14px;
  border: 1px solid #cae2d4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.crm-card span,
.crm-card small,
.crm-record span,
.crm-record small,
.crm-record time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.crm-card strong {
  display: block;
  margin: 7px 0 5px;
  font-size: 20px;
}

.crm-message {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #c9e0d3;
  border-radius: 8px;
  color: #23523c;
  background: rgba(239, 250, 244, 0.92);
  font-size: 13px;
  line-height: 1.55;
}

.crm-integration-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 14px;
  margin-top: 14px;
}

.crm-native-card,
.crm-diagnostics {
  padding: 14px;
  border: 1px solid #cfe3d8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.crm-section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.crm-section-head h3 {
  margin-top: 0;
}

.compact-head {
  margin-top: 16px;
}

.recent-head {
  margin-top: 16px;
}

#wukongNativeFrame {
  display: block;
  width: 100%;
  min-height: 430px;
  border: 1px solid #d5e2dc;
  border-radius: 8px;
  background: #ffffff;
}

[hidden] {
  display: none !important;
}

.crm-checklist,
.crm-pipeline {
  display: grid;
  gap: 9px;
}

.crm-check,
.pipeline-step {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid #d9e9df;
  border-radius: 8px;
  background: #fbfffd;
}

.crm-check strong,
.pipeline-step strong {
  display: block;
  font-size: 13px;
}

.crm-check span,
.pipeline-step small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.crm-check.ok,
.pipeline-step.ok {
  border-color: #b8dfc9;
  background: #f1fbf6;
}

.crm-check.warn,
.pipeline-step.warn {
  border-color: #ead4a7;
  background: #fffaf0;
}

.crm-check.pending,
.pipeline-step.pending {
  border-color: #d7e0eb;
  background: #f8fbff;
}

.pipeline-step {
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
}

.pipeline-step > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.pipeline-step.warn > span {
  background: var(--amber);
}

.pipeline-step.pending > span {
  background: #758399;
}

.crm-recent {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.crm-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid #d9e9df;
  border-radius: 8px;
  background: #fbfffd;
}

.crm-record strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.crm-record.failed {
  border-color: #efc3bd;
  background: #fff7f5;
}

.crm-record.queued {
  border-color: #d6e0ee;
  background: #f8fbff;
}

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

.panel {
  padding: 18px;
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: #3d4a5c;
  font-size: 13px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: var(--text);
  background: #ffffff;
}

textarea {
  min-height: 116px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

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

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.segmented label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #d5dee9;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 13px;
}

.segmented input {
  width: auto;
  height: auto;
}

.bind-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 108px;
  gap: 8px;
  margin-bottom: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}

.metrics div {
  padding: 16px;
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.card-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.social-card,
.list-item,
.empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.social-card {
  padding: 14px;
}

.card-topline,
.meta,
.reasons,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card-topline,
.meta {
  color: var(--muted);
  font-size: 12px;
}

.badge,
.pill,
.reasons span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge {
  color: #174f3f;
  background: #e5f6ef;
}

.pill,
.reasons span {
  color: #42526a;
  background: #eef2f7;
}

.social-card p {
  margin: 8px 0 10px;
}

.comment-text {
  color: #2d3748;
  font-weight: 700;
}

.reply-box {
  margin: 10px 0;
  padding: 10px;
  border-left: 3px solid var(--green);
  border-radius: 6px;
  color: #234237;
  background: #edf9f4;
  line-height: 1.55;
}

.actions {
  margin-top: 12px;
}

.actions button,
.actions a,
.list-item a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  color: var(--blue);
  background: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.list-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.draft-item span {
  max-height: 52px;
  overflow: hidden;
  line-height: 1.45;
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  padding: 18px;
}

.sync-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #cde7d9;
  border-radius: 7px;
  color: #23523c;
  background: #effaf4;
  font-size: 13px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 95, 191, 0.12), rgba(14, 143, 103, 0.12)),
    var(--bg);
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 24px;
  color: var(--text);
}

.login-brand span {
  color: var(--muted);
}

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

.login-form button {
  height: 42px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  color: #ffffff;
  background: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.login-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1060px) {
  .control-grid,
  .workspace-grid,
  .crm-grid,
  .crm-integration-layout {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    min-height: auto;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .crm-hero,
  .crm-section-head {
    display: grid;
  }

  .form-grid,
  .metrics,
  .bind-form {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }
}
