:root {
  color-scheme: light;
  --ink: #19201f;
  --muted: #66736f;
  --line: #dce5e1;
  --surface: #ffffff;
  --surface-2: #f4f8f6;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #315c96;
  --gold: #b7791f;
  --rose: #b23a48;
  --green-soft: #dff3e7;
  --blue-soft: #e3edf9;
  --gold-soft: #f7ecd4;
  --rose-soft: #f9e2e5;
  --shadow: 0 16px 40px rgba(25, 32, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(223, 243, 231, 0.65), rgba(244, 248, 246, 0) 280px),
    var(--surface-2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 44px);
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(220, 229, 225, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  background: var(--teal-dark);
  border-radius: 8px;
  font-weight: 800;
}

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

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.top-nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.page-shell {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 64px;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-intro.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.status-strip,
.metric-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.status-strip strong,
.metric-tag {
  color: var(--ink);
}

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

.kpi-card,
.panel,
.plan-index,
.plan-detail,
.leaderboard-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  min-height: 144px;
  padding: 18px;
}

.kpi-label {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi-value {
  margin: 12px 0 10px;
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 850;
  line-height: 1;
}

.kpi-note {
  color: var(--muted);
  font-size: 13px;
}

.delta {
  display: inline-flex;
  margin-top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.delta.positive {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.delta.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 20px;
}

.accent-panel {
  background: linear-gradient(135deg, #ffffff, #fff8ea);
}

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

.text-link {
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 260px;
  padding: 12px 4px 0;
}

.bar {
  display: grid;
  align-items: end;
  min-height: 220px;
}

.bar-fill {
  display: flex;
  align-items: start;
  justify-content: center;
  min-height: 28px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--teal), var(--blue));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding-top: 8px;
}

.bar-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.focus-list,
.account-list,
.segment-list,
.leaderboard-preview {
  display: grid;
  gap: 12px;
}

.focus-item,
.account-item,
.segment-item,
.leader-preview-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.focus-item p,
.account-item p,
.segment-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.pill.done {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.pill.next {
  color: var(--gold);
  background: var(--gold-soft);
}

.pill.risk {
  color: var(--rose);
  background: var(--rose-soft);
}

.plan-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.plan-index,
.plan-detail {
  padding: 20px;
}

.plan-index {
  position: sticky;
  top: 92px;
  align-self: start;
}

.plan-index h2 {
  margin-bottom: 14px;
}

.plan-button {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.plan-button span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.plan-button.active {
  border-color: var(--teal);
  background: var(--green-soft);
}

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

.plan-section {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-2);
}

.plan-section ul,
.plan-notes {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

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

.crm-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.crm-table th,
.crm-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.crm-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.crm-table td {
  font-size: 14px;
}

.leaderboard-hero {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
  padding: 20px;
}

.leader-card {
  padding: 18px;
  border-radius: 8px;
  background: var(--surface-2);
}

.leader-card:first-child {
  color: #fff;
  background: linear-gradient(135deg, var(--teal-dark), var(--blue));
}

.leader-card .rank {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.leader-card .name {
  margin: 10px 0 4px;
  font-size: 28px;
  font-weight: 900;
}

.leader-card .spend {
  font-size: 18px;
  font-weight: 800;
}

.leader-preview-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
}

.leader-preview-row strong {
  display: block;
}

.leader-preview-row span {
  color: var(--muted);
  font-size: 13px;
}

.rank-dot {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}

@media (max-width: 980px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column,
  .plan-layout,
  .leaderboard-hero {
    grid-template-columns: 1fr;
  }

  .plan-index {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-header,
  .page-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 22px;
  }

  h1 {
    font-size: 36px;
  }

  .kpi-grid,
  .plan-section-grid,
  .bar-chart {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    min-height: 0;
  }

  .bar {
    min-height: 44px;
  }

  .bar-fill {
    height: 38px !important;
  }
}

