:root {
  color-scheme: dark;
  --page: #edf1f4;
  --surface: #090b0e;
  --panel: #13171c;
  --panel-soft: #171c22;
  --field: #0b0e11;
  --border: #262e36;
  --text: #f2f5f7;
  --muted: #8c99a8;
  --lime: #bfff33;
  --cyan: #2ec7e0;
  --purple: #a680ff;
  --orange: #ff912e;
  --green: #61eb80;
  --red: #ff5259;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Onest, Inter, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.login-surface {
  position: relative;
  display: flex;
  width: 360px;
  max-width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 22px 24px 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-field {
  display: flex;
  width: 100%;
  min-height: 41px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.login-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.login-field input::placeholder {
  color: var(--text);
  opacity: 1;
}

.login-field input:focus {
  outline: 0;
}

.login-button {
  min-height: 33px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: #0d0f12;
  font-size: 10px;
  font-weight: 800;
}

.login-error {
  position: absolute;
  bottom: 6px;
  left: 24px;
  right: 24px;
  margin: 0;
  color: var(--red);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  visibility: hidden;
}

.login-error.is-visible {
  visibility: visible;
}

.figma-page {
  min-height: 100vh;
  padding: 24px;
}

.app-surface {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(1600px, 100%);
  min-height: 802px;
  margin: 0 auto;
  padding: 22px 24px 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding-bottom: 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--lime);
  color: #0d0f12;
  font-size: 12px;
  font-weight: 800;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
}

.brand-copy strong {
  font-size: 13px;
  line-height: 1.2;
}

.brand-copy span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
}

.tabs {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.tab,
.nav-action,
.period-button,
.primary-button,
.secondary-button,
.chat-input button {
  display: inline-flex;
  align-items: center;
  min-height: 33px;
  border: 0;
  border-radius: 10px;
  white-space: nowrap;
  font-weight: 800;
}

.tab {
  padding: 9px 13px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
}

.tab.is-active {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel-soft);
}

.crm-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

.crm-state i,
.status-badge i,
.message-role i,
.channel-pill i,
.status-row i {
  display: block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.crm-state i {
  width: 7px;
  height: 7px;
  color: var(--cyan);
}

.nav-action,
.primary-button {
  justify-content: center;
  padding: 10px 14px;
  border: 0;
  background: var(--lime);
  color: #0d0f12;
  font-size: 10px;
}

.primary-button {
  width: 100%;
}

.primary-button:disabled {
  opacity: 0.75;
  cursor: default;
}

.secondary-button,
.chat-input button,
.period-button {
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 10px;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.page-title {
  flex: 1 1 auto;
  min-width: 0;
}

.eyebrow,
.section-kicker,
.panel-title span,
.updated span,
.field-card span,
.budget-card span {
  display: block;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 9px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 34px;
}

h2 {
  font-size: 16px;
  line-height: 20px;
}

.updated {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
}

.updated strong {
  color: var(--text);
  font-size: 11px;
}

.period-button {
  gap: 8px;
  min-height: 37px;
  font-size: 11px;
}

.plan-summary,
.panel,
.channels-strip,
.agent-pipeline,
.settings-actions {
  border: 1px solid var(--border);
  background: var(--panel);
}

.plan-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  padding: 24px;
  border-radius: 18px;
}

.plan-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.plan-top > div {
  flex: 1 1 auto;
  min-width: 0;
}

.plan-top strong {
  display: block;
  margin-top: 4px;
  font-size: 38px;
  line-height: 44px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge i {
  width: 6px;
  height: 6px;
}

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

.stat-card,
.field-card,
.metric-row,
.channel-pill,
.message,
.chat-input,
.agent-stage,
.status-row,
.toggle-row {
  border-radius: 10px;
  background: var(--panel-soft);
}

.stat-card {
  display: flex;
  min-height: 69px;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.stat-card span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.stat-card strong {
  font-size: 20px;
  line-height: 1.2;
}

.forecast-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.forecast-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.forecast-progress strong {
  color: var(--text);
  font-size: 9px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--field);
}

.progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--lime);
}

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

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 18px;
  border-radius: 16px;
}

.panel-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 0;
  color: var(--text);
  text-align: left;
}

.metric-row span {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  font-weight: 600;
}

.metric-row strong {
  flex: 0 0 auto;
  font-size: 16px;
}

.metric-row.is-pressed {
  outline: 1px solid var(--lime);
}

.channels-strip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 16px;
}

.channels-header,
.pipeline-header,
.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.channels-header > div,
.pipeline-header > div {
  flex: 1 1 auto;
}

.channels-header > span,
.pipeline-header > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}

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

.channel-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 29px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  color: var(--text);
  min-width: 0;
}

.channel-pill i {
  width: 7px;
  height: 7px;
}

.channel-pill span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
}

.channel-pill strong {
  flex: 0 0 auto;
  font-size: 9px;
  white-space: nowrap;
}

.ai-workspace,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 14px;
}

.chat-panel,
.launch-brief {
  min-height: 414px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1px solid var(--border);
}

.message.from-user {
  border-color: rgba(191, 255, 51, 0.3);
  background: #1f2b14;
}

.message-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 8px;
  font-weight: 800;
}

.message-role i {
  width: 7px;
  height: 7px;
}

.message p {
  font-size: 11px;
  line-height: 17px;
}

.chat-input {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 59px;
  margin-top: auto;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  background: var(--field);
}

.chat-input span {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 10px;
}

.launch-brief {
  flex: 0 0 430px;
}

.brief-fields,
.settings-fields,
.status-list,
.rules-list {
  display: grid;
  gap: 8px;
}

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

.field-card {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

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

.field-card strong,
.budget-card strong {
  overflow: hidden;
  font-size: 11px;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-card {
  display: flex;
  min-height: 47px;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1f2b14;
}

.budget-card strong {
  color: var(--lime);
}

.agent-pipeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
}

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

.agent-stage {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}

.stage-number {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 18%, transparent);
  font-size: 8px;
  font-weight: 900;
}

.agent-stage div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agent-stage strong {
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-stage span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.settings-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-panel {
  gap: 12px;
}

.status-row,
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 33px;
  padding: 10px 12px;
}

.status-row i {
  width: 8px;
  height: 8px;
}

.status-row span {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  font-weight: 600;
}

.status-row strong {
  flex: 0 0 auto;
  font-size: 9px;
  white-space: nowrap;
}

.toggle-row {
  min-height: 46px;
}

.toggle-row > span {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.toggle-row strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-row em {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-row > i {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #38424d;
}

.toggle-row > i::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 0.18s ease, background 0.18s ease;
}

.toggle-row input:checked + i {
  background: var(--lime);
}

.toggle-row input:checked + i::after {
  transform: translateX(16px);
  background: var(--surface);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 63px;
  padding: 14px 16px;
  border-radius: 14px;
}

.settings-actions div {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
}

.settings-actions strong {
  font-size: 10px;
}

.settings-actions span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.accent-lime {
  color: var(--lime);
}

.accent-cyan {
  color: var(--cyan);
}

.accent-purple {
  color: var(--purple);
}

.accent-orange {
  color: var(--orange);
}

.accent-green {
  color: var(--green);
}

.accent-red {
  color: var(--red);
}

.accent-white {
  color: var(--text);
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--lime) 55%, transparent);
  outline-offset: 2px;
}

@media (max-width: 1200px) {
  .app-nav,
  .page-header,
  .channels-header,
  .pipeline-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .overview-row,
  .ai-workspace,
  .settings-grid,
  .agent-stages,
  .channel-pills {
    grid-template-columns: 1fr;
  }

  .launch-brief {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .figma-page {
    padding: 12px;
  }

  .app-surface {
    padding: 16px;
    border-radius: 14px;
  }

  h1 {
    font-size: 23px;
    line-height: 29px;
  }

  .plan-top,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .plan-top strong {
    font-size: 30px;
    line-height: 36px;
  }

  .plan-stats,
  .settings-fields {
    grid-template-columns: 1fr;
  }
}
