:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --page: #f5f7fb;
  --panel: #ffffff;
  --loyal: #0f766e;
  --regular: #2563eb;
  --churned: #b45309;
  --aware: #7c3aed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 28px clamp(18px, 4vw, 44px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

main {
  padding: 22px clamp(18px, 4vw, 44px) 42px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #f8fafc;
}

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

.segment-card,
.panel,
.rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment-card {
  padding: 16px;
  min-height: 134px;
}

.segment-card .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.segment-card .number {
  margin-top: 14px;
  font-size: 32px;
  font-weight: 800;
}

.segment-card .sub {
  color: var(--muted);
  font-size: 13px;
}

.workbench {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rail {
  padding: 16px;
  position: sticky;
  top: 12px;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  margin-bottom: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.rule-box {
  margin-top: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.rule-box strong {
  display: block;
  margin-bottom: 8px;
}

.rule-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.tab {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 6px;
  padding: 8px 14px;
  color: #344054;
  font: inherit;
  cursor: pointer;
}

.tab.active {
  background: #172033;
  color: #ffffff;
  border-color: #172033;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
  overflow: hidden;
}

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

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 210px) minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.movement-list,
.funnel {
  display: grid;
  gap: 10px;
}

.movement-item,
.funnel-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.movement-item strong,
.funnel-row strong {
  font-size: 14px;
}

.movement-item span,
.funnel-row span {
  color: var(--muted);
  font-size: 13px;
}

.funnel-track {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 999px;
  background: #edf1f7;
  overflow: hidden;
}

.funnel-fill {
  height: 100%;
}

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

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

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: #344054;
  background: #f8fafc;
}

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

  .rail {
    position: static;
  }
}

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

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