:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-soft: #eef7f5;
  --text: #17211f;
  --muted: #66726f;
  --line: #dce5e2;
  --primary: #147864;
  --primary-strong: #0d5f50;
  --accent: #b64255;
  --gold: #b28435;
  --ink: #263330;
  --shadow: 0 14px 40px rgba(35, 55, 49, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px clamp(14px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.top-actions,
.hero-actions,
.event-actions,
.integration-actions,
.card-topline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  min-width: 0;
}

.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.topbar h1,
.hero-panel h2,
.section-heading h2,
.drawer h2,
.feature-hero h3 {
  margin: 0;
}

.topbar h1 {
  overflow: hidden;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 850;
}

.tabs {
  position: sticky;
  top: 71px;
  z-index: 19;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px clamp(14px, 4vw, 40px);
  background: rgba(246, 247, 248, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.tab,
.ghost-button,
.primary-button,
.secondary-button,
.text-button,
.icon-button,
.segmented button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  white-space: nowrap;
}

.tab {
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab.active {
  background: var(--ink);
  color: #ffffff;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 0 16px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface-soft);
  color: var(--primary-strong);
}

.ghost-button {
  background: transparent;
  color: var(--primary-strong);
  border: 1px solid var(--line);
}

.text-button {
  min-width: auto;
  background: transparent;
  color: var(--primary);
  font-weight: 850;
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 40px) 84px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel,
.feature-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: stretch;
  padding: clamp(22px, 4vw, 36px);
  background:
    linear-gradient(120deg, rgba(20, 120, 100, 0.11), rgba(182, 66, 85, 0.08)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel h2 {
  max-width: 900px;
  font-size: clamp(28px, 6vw, 54px);
  line-height: 1.1;
}

.hero-copy,
.feature-hero p {
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.hero-actions {
  flex-wrap: wrap;
  margin-top: 20px;
}

.notice,
.login-strip {
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  line-height: 1.7;
}

.login-strip {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.metric-grid,
.capability-grid,
.resource-grid,
.product-list,
.story-grid,
.flow-grid,
.module-grid {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 28px;
}

.metric-grid.compact {
  margin-top: 0;
}

.metric-card,
.capability-card,
.resource-card,
.product-card,
.event-card,
.record-card,
.question-card,
.story-card,
.flow-card,
.module-card,
.auth-card,
.integration-panel,
.side-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(35, 55, 49, 0.06);
}

.metric-card {
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary-strong);
  font-size: clamp(24px, 4vw, 36px);
}

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

.metric-card span,
.muted {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 26px 0 14px;
}

.section-heading h2 {
  font-size: clamp(20px, 4vw, 28px);
}

.sticky-heading {
  position: sticky;
  top: 126px;
  z-index: 10;
  padding: 10px 0;
  background: rgba(246, 247, 248, 0.95);
  backdrop-filter: blur(14px);
}

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

.story-grid,
.module-grid,
.resource-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.capability-card,
.resource-card,
.product-card,
.story-card,
.module-card,
.auth-card,
.side-panel,
.record-card,
.question-card {
  padding: 18px;
}

.flow-card {
  padding: 18px;
  border-top: 4px solid var(--primary);
}

.flow-card span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 850;
}

.capability-card h3,
.resource-card h3,
.event-card h3,
.product-card h3,
.record-card h3,
.question-card h3,
.story-card h3,
.flow-card h3,
.module-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
}

.capability-card p,
.resource-card p,
.event-card p,
.product-card p,
.record-card p,
.question-card p,
.story-card p,
.flow-card p,
.module-card p,
.drawer-body p {
  color: var(--muted);
  line-height: 1.65;
}

ul {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink);
  line-height: 1.8;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
}

.badge.status {
  background: rgba(178, 132, 53, 0.13);
  color: #7c5a1f;
}

.resource-card,
.product-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
}

.card-topline {
  justify-content: space-between;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

.event-list {
  display: grid;
  gap: 14px;
}

.event-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
}

.event-time {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.event-time span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
}

.event-main {
  padding: 18px;
}

.event-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.event-meta div {
  padding: 10px;
  background: #f8faf9;
  border-radius: 8px;
}

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

.event-meta dd {
  margin: 3px 0 0;
  font-weight: 800;
}

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

.integration-panel {
  padding: 18px;
}

.integration-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--gold);
}

.status-dot.ok {
  background: var(--primary);
}

.status-dot.warn {
  background: var(--accent);
}

.integration-actions {
  flex-wrap: wrap;
  margin: 12px 0;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 18px;
}

.feature-hero {
  margin-bottom: 16px;
}

.feature-hero h3 {
  font-size: clamp(24px, 4vw, 40px);
}

.two-col,
.profile-grid,
.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.ops-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.record-list,
.question-list {
  display: grid;
  gap: 12px;
}

.lead-update-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.lead-update-form label:nth-child(3),
.lead-update-form button {
  grid-column: 1 / -1;
}

.ops-materials {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.ops-materials details {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.ops-materials summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 850;
}

.mini-material {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.mini-material p {
  margin: 6px 0;
}

.inline-form,
.stack-form {
  display: grid;
  gap: 12px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 120, 100, 0.12);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(0, 0, 0, 0.32);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(560px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
  background: var(--surface);
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.icon-button {
  width: 42px;
  background: #f1f4f3;
  color: var(--ink);
  font-size: 24px;
}

.drawer-body {
  display: grid;
  gap: 14px;
}

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

.segmented button {
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-weight: 800;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.empty-state {
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .hero-panel,
  .feature-hero,
  .two-col,
  .profile-grid,
  .ops-layout {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .capability-grid,
  .story-grid,
  .flow-grid,
  .module-grid,
  .resource-grid,
  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .event-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .top-actions .primary-button,
  .top-actions .ghost-button {
    min-width: 72px;
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
  }

  .tabs {
    top: 89px;
  }

  .sticky-heading {
    top: 143px;
  }

  .metric-grid,
  .capability-grid,
  .story-grid,
  .flow-grid,
  .module-grid,
  .resource-grid,
  .product-list,
  .event-meta {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .event-card {
    grid-template-columns: 1fr;
  }

  .event-time {
    justify-items: start;
    text-align: left;
  }

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

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

  .drawer {
    padding: 18px;
  }

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