:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f3;
  color: #15201d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(24, 94, 83, 0.08), transparent 320px),
    #f6f7f3;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid #d9ded7;
  background: rgba(246, 247, 243, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  color: #65706b;
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #173a34;
  border: 1px solid #d7ddd8;
  cursor: pointer;
}

.icon-button:hover {
  border-color: #0f766e;
}

.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100vh - 69px);
}

.sidebar {
  padding: 20px 14px;
  border-right: 1px solid #d9ded7;
  background: #eef2ed;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #243531;
  cursor: pointer;
  text-align: left;
}

.nav-item[aria-current="page"] {
  background: #0f766e;
  color: #ffffff;
}

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

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

.page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-copy {
  margin: 6px 0 0;
  max-width: 760px;
  color: #63706b;
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  color: #0f4b44;
  background: #dcece8;
  font-size: 13px;
  white-space: nowrap;
}

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

.metric {
  min-height: 104px;
  padding: 16px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #dce1dc;
}

.metric-label {
  color: #65706b;
  font-size: 13px;
}

.metric-value {
  margin-top: 12px;
  font-size: 28px;
  font-weight: 750;
}

.metric-value span {
  margin-left: 6px;
  color: #65706b;
  font-size: 13px;
  font-weight: 650;
}

.metric-note {
  margin-top: 8px;
  color: #68746f;
  font-size: 12px;
  line-height: 1.4;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.panel {
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #dce1dc;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid #edf0ec;
}

.panel-title {
  margin: 0;
  font-size: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid #edf0ec;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #60706a;
  font-size: 12px;
  text-transform: uppercase;
}

.state {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #63706b;
  text-align: center;
}

.state strong {
  display: block;
  margin-bottom: 6px;
  color: #21332e;
}

.state-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid #dce8e4;
  border-top-color: #0f766e;
  animation: spin 900ms linear infinite;
  margin: 0 auto 12px;
}

.stack {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.event-row {
  padding: 12px;
  border-radius: 8px;
  background: #f7f9f6;
  border: 1px solid #e5ebe5;
}

.event-row strong {
  display: block;
  margin-bottom: 4px;
}

.event-row span {
  color: #65706b;
  font-size: 13px;
}

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

.menu-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}

.menu-group-card {
  min-height: 112px;
  padding: 12px;
  border: 1px solid #e5ebe5;
  border-radius: 8px;
  background: #f8faf8;
}

.menu-group-card strong {
  display: block;
  color: #20332f;
  font-size: 14px;
}

.menu-group-card span {
  display: block;
  margin-top: 8px;
  color: #68746f;
  font-size: 13px;
  line-height: 1.45;
}

.menu-tile,
.workflow-step,
.check-item {
  border: 1px solid #e5ebe5;
  border-radius: 8px;
  background: #f8faf8;
}

.menu-tile {
  min-height: 78px;
  padding: 12px;
}

.menu-tile strong,
.check-item strong {
  display: block;
  color: #20332f;
  font-size: 14px;
}

.menu-tile span,
.check-item span {
  display: block;
  margin-top: 6px;
  color: #68746f;
  font-size: 13px;
  line-height: 1.4;
}

.crm-section {
  margin-top: 14px;
}

.workflow,
.check-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.workflow-step > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 700;
}

.workflow-step strong {
  display: block;
  color: #20332f;
  font-size: 14px;
}

.workflow-step p {
  margin: 5px 0 0;
  color: #68746f;
  font-size: 13px;
  line-height: 1.45;
}

.check-item {
  min-height: 68px;
  padding: 12px;
}

.crm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
  align-items: stretch;
  gap: 14px;
  margin-bottom: 18px;
}

.crm-hero > div {
  border: 1px solid #dce1dc;
  border-radius: 8px;
  background: #ffffff;
  padding: 18px;
}

.crm-hero h2 {
  margin: 6px 0 0;
  max-width: 860px;
  font-size: 28px;
  line-height: 1.2;
}

.crm-hero p {
  margin: 8px 0 0;
  max-width: 900px;
  color: #62706b;
  line-height: 1.5;
}

.eyebrow {
  color: #0f766e;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.route-card {
  display: grid;
  align-content: center;
  gap: 8px;
  background: #15332e !important;
  color: #ffffff;
}

.route-card strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.route-card span {
  color: #cae2dc;
  font-size: 13px;
}

.crm-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  margin-bottom: 4px;
}

.crm-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #d7ddd8;
  background: #ffffff;
  color: #21332e;
  cursor: pointer;
  white-space: nowrap;
}

.crm-tab[aria-current="page"] {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.crm-tab small {
  display: inline-grid;
  min-width: 24px;
  min-height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(21, 32, 29, 0.08);
  font-size: 11px;
}

.crm-tab[aria-current="page"] small {
  background: rgba(255, 255, 255, 0.18);
}

.action-board,
.role-grid,
.schema-grid,
.score-strip,
.kpi-formula,
.report-grid,
.permission-grid,
.question-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.action-tile,
.role-card,
.schema-block,
.score-box,
.report-card,
.message-preview {
  border: 1px solid #e5ebe5;
  border-radius: 8px;
  background: #f8faf8;
}

.action-tile {
  min-height: 126px;
  padding: 14px;
  border-top: 4px solid #5b8c7c;
}

.action-tile[data-tone="warning"] {
  border-top-color: #b7791f;
}

.action-tile[data-tone="danger"] {
  border-top-color: #b42318;
}

.action-tile span,
.score-box span {
  display: block;
  color: #60706a;
  font-size: 13px;
}

.action-tile strong,
.score-box strong {
  display: block;
  margin-top: 8px;
  color: #1c302b;
  font-size: 30px;
  line-height: 1;
}

.action-tile small,
.score-box small {
  display: block;
  margin-top: 10px;
  color: #68746f;
  line-height: 1.35;
}

.role-grid,
.permission-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.role-card {
  min-height: 142px;
  padding: 14px;
}

.role-card strong,
.schema-block strong,
.report-card strong,
.message-preview strong {
  display: block;
  color: #20332f;
}

.role-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #65706b;
  font-size: 13px;
  line-height: 1.55;
}

.compact-list,
.cadence-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
}

.data-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e8f1ed;
  color: #17483f;
  font-size: 12px;
  font-weight: 650;
}

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

.schema-block {
  min-height: 124px;
  padding: 14px;
}

.schema-block > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding: 14px;
}

.pipeline-step {
  min-height: 112px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #dfe6df;
  background: #f8faf8;
}

.pipeline-step strong,
.pipeline-step span,
.pipeline-step small,
.report-card span {
  display: block;
}

.pipeline-step span {
  margin-top: 8px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 750;
}

.pipeline-step small,
.report-card span,
.message-preview p {
  margin-top: 8px;
  color: #68746f;
  line-height: 1.4;
}

.score-strip,
.kpi-formula {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-formula {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-box {
  min-height: 122px;
  padding: 14px;
}

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

.report-card {
  min-height: 104px;
  padding: 14px;
}

.message-preview {
  margin: 14px;
  padding: 14px;
}

.message-preview p {
  margin-bottom: 0;
}

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

.question-grid > div {
  min-height: 62px;
  padding: 12px;
  border-radius: 8px;
  background: #f8faf8;
  border: 1px solid #e5ebe5;
  color: #20332f;
  line-height: 1.4;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .sidebar {
    position: sticky;
    top: 69px;
    z-index: 4;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #d9ded7;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
  }

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

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

  .crm-hero {
    grid-template-columns: 1fr;
  }

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

  .action-board,
  .role-grid,
  .schema-grid,
  .score-strip,
  .kpi-formula,
  .report-grid,
  .permission-grid,
  .question-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .brand span {
    max-width: 210px;
  }

  .main {
    padding: 16px;
  }

  .page-head {
    flex-direction: column;
  }

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

  .menu-grid,
  .menu-group-grid {
    grid-template-columns: 1fr;
  }

  .crm-hero h2 {
    font-size: 22px;
  }

  .action-board,
  .role-grid,
  .schema-grid,
  .score-strip,
  .kpi-formula,
  .report-grid,
  .permission-grid,
  .question-grid {
    grid-template-columns: 1fr;
  }
}
