:root {
  color-scheme: light;
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --ink: #15201f;
  --muted: #667371;
  --line: #d9e0df;
  --teal: #1f8a83;
  --teal-dark: #12645f;
  --blue: #275c9d;
  --yellow: #f0b949;
  --red: #bc4b51;
  --shadow: 0 18px 45px rgba(27, 40, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #15201f;
  color: #f7fbfa;
}

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

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

.brand-name {
  font-weight: 800;
}

.brand-note,
.panel-label,
.metric-label,
.eyebrow,
small,
.muted,
.muted-list {
  color: var(--muted);
}

.sidebar .brand-note,
.sidebar .panel-label,
.sidebar p {
  color: #a9b7b5;
}

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

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dce6e4;
  cursor: pointer;
  text-decoration: none;
}

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

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0 12px;
}

.mode {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #eaf1f0;
  cursor: pointer;
}

.mode.active {
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.workspace {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 28px;
}

.topbar,
.section-head,
.client-row,
.goal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 98px;
}

.eyebrow {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.82fr);
  gap: 20px;
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.primary-button {
  padding: 0 18px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.secondary-button {
  padding: 0 14px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  font-weight: 700;
}

.icon-button {
  width: 42px;
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
  font-size: 20px;
}

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

.wide-form {
  max-width: 960px;
}

.metric,
.card,
.flow-panel,
.brief-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 124px;
  padding: 18px;
}

.metric strong {
  font-size: 34px;
  line-height: 1;
}

.metric-delta {
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.82fr);
  gap: 20px;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 20px;
}

.flow-panel,
.brief-panel,
.card {
  padding: 20px;
}

.section-head {
  margin-bottom: 18px;
}

.section-head.compact {
  margin-bottom: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ready {
  background: #e3f3ef;
  color: var(--teal-dark);
}

.status-pill.warn {
  background: #fff4d7;
  color: #90640e;
}

.status-pill.neutral {
  background: #edf1f2;
  color: #53615f;
}

.flow {
  display: grid;
  grid-template-columns: 1fr 28px 1fr 28px 1fr 28px 1fr 28px 1fr;
  align-items: stretch;
  margin: 20px 0;
}

.flow-node {
  display: grid;
  gap: 8px;
  min-height: 152px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.flow-node.accent {
  border-color: rgba(31, 138, 131, 0.45);
  background: #e8f5f3;
}

.node-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-weight: 900;
}

.connector {
  align-self: center;
  height: 2px;
  background: var(--line);
}

.decision-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.decision-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.decision-row:first-child {
  border-top: 0;
}

.decision-row.header {
  background: #eef4f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.checklist {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  line-height: 1.35;
}

.checklist span {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--teal);
  box-shadow: inset 0 0 0 5px #dff3ef;
}

.client-list,
.goal-stack {
  display: grid;
  gap: 10px;
}

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

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

.client-form label {
  display: grid;
  gap: 7px;
}

.client-form label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.client-form input,
.client-form select,
.client-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
}

.client-form textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
}

.full-field {
  grid-column: 1 / -1;
}

.client-form .primary-button {
  align-self: end;
}

.payload-preview {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.payload-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.payload-preview code {
  display: block;
  min-height: 54px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111b1a;
  color: #dff3ef;
  white-space: pre-wrap;
}

.mock-max-button {
  width: 100%;
  min-height: 54px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
}

.rule-stack {
  display: grid;
  gap: 10px;
}

.rule-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.rule-row span {
  color: var(--muted);
}

.switch {
  display: inline-grid;
  grid-template-columns: 42px auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cfd8d6;
  transition: background 0.18s ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
  transition: transform 0.18s ease;
}

.switch input:checked + span {
  background: var(--teal);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.campaign-list {
  margin-top: 16px;
}

.empty-state {
  display: grid;
  gap: 6px;
  min-height: 120px;
  place-content: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: center;
}

.empty-state span {
  color: var(--muted);
  font-size: 14px;
}

.empty-state[hidden] {
  display: none;
}

.client-row {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.client-row div {
  display: grid;
  gap: 5px;
}

.client-row span:not(.status-pill) {
  color: var(--muted);
  font-size: 13px;
}

.goal-item {
  justify-content: flex-start;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.goal-item > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: #eaf0f4;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.goal-item div {
  display: grid;
  gap: 4px;
}

.city-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.city {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}

.city.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  font-weight: 800;
}

.muted {
  margin-bottom: 0;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 12px;
  padding-left: 22px;
  margin: 0;
}

.timeline li {
  padding-left: 4px;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .flow {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .connector {
    width: 2px;
    height: 20px;
    justify-self: center;
  }

  .flow-node {
    min-height: 118px;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav-item {
    justify-content: center;
    text-align: center;
  }

  .metrics-grid,
  .main-grid,
  .columns,
  .page-grid,
  .connections-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .client-row {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .primary-button {
    flex: 1;
  }

  .metrics-grid,
  .nav,
  .city-map,
  .client-form {
    grid-template-columns: 1fr;
  }

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

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

  h1 {
    font-size: 34px;
  }
}
