:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #d8dde5;
  --panel: #ffffff;
  --paper: #f7f4ef;
  --charcoal: #18242f;
  --teal: #0f766e;
  --coral: #c2410c;
  --gold: #b7791f;
  --green: #2f7d32;
  --red: #b42318;
  --blue: #315c99;
  --shadow: 0 20px 50px rgba(24, 36, 47, 0.10);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.05), rgba(194, 65, 12, 0.04)),
    var(--paper);
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

.sidebar {
  background: var(--charcoal);
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

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

.mark {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #f8fafc;
  color: var(--charcoal);
  border-radius: 8px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.sidebar .eyebrow {
  color: #b8c2cf;
}

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

h1 {
  margin: 0;
  font-size: 1.35rem;
}

h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
}

h3 {
  margin-bottom: 8px;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.15;
}

h4 {
  margin-bottom: 8px;
  font-size: 1rem;
}

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

.nav-item {
  border: 0;
  background: transparent;
  color: #dce3eb;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  text-align: left;
  min-width: 0;
}

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

.nav-icon {
  width: 24px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 900;
}

.sidebar-note {
  margin-top: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  color: #edf2f7;
}

.sidebar-note p {
  margin-bottom: 0;
  color: #cbd5e1;
  line-height: 1.45;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

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

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

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

.segmented span {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.segmented input:checked + span {
  background: var(--charcoal);
  color: #ffffff;
}

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

.icon-button,
.ghost,
.primary {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.icon-button,
.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--charcoal);
}

.primary {
  border: 1px solid var(--charcoal);
  background: var(--charcoal);
  color: #ffffff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.contract-status {
  min-height: 36px;
  margin-bottom: 16px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  padding: 8px 12px;
  background: rgba(15, 118, 110, 0.06);
  color: #24524e;
  font-size: 0.9rem;
  line-height: 1.35;
}

.contract-status span {
  display: inline-block;
  margin-left: 10px;
  color: var(--muted);
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.access-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.access-card {
  background: var(--panel);
  border: 1px solid rgba(216, 221, 229, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}

.access-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 14px;
}

.access-header h4,
.access-card h4 {
  margin-bottom: 6px;
}

.access-actions {
  margin-top: 14px;
}

.access-status {
  position: sticky;
  top: 18px;
}

.website-scan {
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  background: #fafafa;
}

.builder-main,
.side-panel,
.step-panel,
.metric-panel,
.partner-note,
.report-band {
  background: var(--panel);
  border: 1px solid rgba(216, 221, 229, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.builder-main {
  padding: 18px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.step-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
  color: var(--muted);
  min-height: 76px;
}

.step-item.complete {
  border-color: rgba(47, 125, 50, 0.32);
  background: rgba(47, 125, 50, 0.07);
  color: var(--green);
}

.step-item.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
  color: var(--teal);
}

.step-num {
  width: 24px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.step-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 850;
}

.mobile-step-header {
  display: none;
  margin-bottom: 14px;
  font-weight: 850;
}

.progress-track {
  margin-top: 8px;
  height: 5px;
  border-radius: 8px;
  background: #e6e8ed;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 160ms ease;
}

.step-panel {
  box-shadow: none;
  padding: 20px;
}

.step-copy p:last-child {
  color: var(--muted);
  line-height: 1.5;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.field span {
  color: #374151;
  font-size: 0.88rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

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

.choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  text-align: left;
  min-height: 86px;
}

.choice.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.choice strong {
  display: block;
  margin-bottom: 5px;
}

.choice small {
  color: var(--muted);
  line-height: 1.35;
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.builder-side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.side-panel {
  padding: 16px;
  box-shadow: none;
}

.check-item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #eef0f3;
  align-items: start;
}

.check-item:last-child {
  border-bottom: 0;
}

.check-dot {
  width: 20px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  flex: none;
}

.check-item.done .check-dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.check-item span:last-child {
  color: var(--muted);
  line-height: 1.35;
}

.package-card {
  border-left: 4px solid var(--teal);
  padding-left: 12px;
}

.package-card.growth {
  border-color: var(--coral);
}

.package-card strong {
  display: block;
  font-size: 1.55rem;
  margin: 2px 0 8px;
}

.package-card p {
  color: var(--muted);
  line-height: 1.45;
}

.package-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 0;
  font-size: 0.9rem;
}

.package-card dd {
  margin: 0;
  font-weight: 850;
}

.agent-step {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  padding: 8px 0;
}

.status-dot {
  width: 10px;
  aspect-ratio: 1;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--teal);
}

.status-dot.warn {
  background: var(--gold);
}

.status-dot.done {
  background: var(--green);
}

.agent-step p {
  margin-bottom: 2px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.agent-step small {
  color: var(--muted);
}

.creative-preview {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.tv-frame {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.88), rgba(49, 92, 153, 0.86)),
    #111827;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tv-frame:before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px dashed rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  pointer-events: none;
}

.mock-logo {
  width: 64px;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--charcoal);
  font-weight: 900;
}

.tv-frame h4 {
  max-width: 70%;
  font-size: clamp(1rem, 2vw, 1.7rem);
  margin: 0;
}

.tv-frame footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  font-weight: 850;
}

.qr {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 4px;
  background:
    linear-gradient(90deg, #111 50%, transparent 0) 0 0 / 12px 12px,
    linear-gradient(#111 50%, transparent 0) 0 0 / 12px 12px,
    #fff;
  border: 5px solid #fff;
}

.qa-list {
  display: grid;
  gap: 8px;
}

.qa-item {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
}

.qa-item.pass {
  border-left-color: var(--green);
}

.qa-item.warn {
  border-left-color: var(--gold);
}

.qa-item.review {
  border-left-color: var(--red);
}

.split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.decision-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.decision-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.decision-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef4f8;
  color: #27445d;
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.warn {
  background: rgba(183, 121, 31, 0.14);
  color: #7a4d08;
}

.kpi-grid,
.partner-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metric-panel {
  padding: 18px;
}

.metric-panel span {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.86rem;
}

.metric-panel strong {
  display: block;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  margin: 10px 0 6px;
}

.metric-panel small {
  color: var(--muted);
}

.report-bands {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.report-band {
  box-shadow: none;
  padding: 16px;
}

.report-band p,
.partner-note p,
.side-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.partner-note {
  margin-top: 16px;
  padding: 18px;
  box-shadow: none;
}

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

.ledger-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.ledger-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ledger-item strong {
  overflow-wrap: anywhere;
}

.ledger-item small {
  color: var(--muted);
  line-height: 1.35;
}

.campaign-ledger {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.campaign-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.campaign-row h4 {
  margin: 10px 0 6px;
  font-size: 1.05rem;
}

.campaign-row p {
  color: var(--muted);
  line-height: 1.45;
}

.campaign-state-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.campaign-state-grid span {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: #fafafa;
  min-width: 0;
}

.campaign-state-grid strong,
.campaign-state-grid small {
  overflow-wrap: anywhere;
}

.campaign-state-grid small {
  color: var(--muted);
}

.notice {
  border: 1px solid rgba(49, 92, 153, 0.22);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
  background: rgba(49, 92, 153, 0.06);
  color: #25466f;
  line-height: 1.45;
}

.estimate-panel,
.optimization-card,
.chat-panel {
  background: #fff;
  border: 1px solid rgba(216, 221, 229, 0.9);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.estimate-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.estimate-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.mini-metrics,
.variant-grid {
  display: grid;
  gap: 10px;
}

.mini-metrics span,
.variant-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 10px;
  background: #fafafa;
}

.mini-metrics strong {
  font-size: 1.45rem;
}

.mini-metrics small,
.variant-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.optimization-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.operator-section {
  background: #fff;
  border: 1px solid rgba(216, 221, 229, 0.9);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

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

.supply-section {
  margin-top: 16px;
}

.supply-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.supply-card {
  display: grid;
  gap: 12px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
  min-width: 0;
}

.supply-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.supply-card h4,
.supply-card p {
  margin-bottom: 4px;
}

.supply-card p,
.compact-list {
  color: var(--muted);
  line-height: 1.4;
}

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

.supply-metrics strong {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.vast-tag-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.operator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
  min-width: 0;
}

.operator-row h4 {
  margin-bottom: 4px;
}

.operator-row p,
.operator-row small {
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.operator-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.optimization-card h4 {
  margin-top: 12px;
}

.optimization-card p {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 0;
}

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

.variant-grid strong {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.concierge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.chat-panel {
  box-shadow: var(--shadow);
}

.chat-thread {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  max-height: 420px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  background: #fafafa;
}

.chat-message {
  width: min(76%, 620px);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.chat-message.business {
  justify-self: end;
  background: #dcf8c6;
  border-color: rgba(47, 125, 50, 0.22);
}

.chat-message p {
  margin-bottom: 4px;
  line-height: 1.45;
}

.chat-message small {
  color: var(--muted);
  font-size: 0.74rem;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-input input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

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

  .sidebar {
    position: static;
    padding: 16px;
  }

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

  .sidebar-note {
    display: none;
  }

  .builder-layout,
  .access-layout,
  .split-view,
  .concierge-layout,
  .operator-grid,
  .supply-grid,
  .campaign-row {
    grid-template-columns: 1fr;
  }

  .builder-side {
    position: static;
  }

  .access-status {
    position: static;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .supply-card-header,
  .supply-metrics {
    grid-template-columns: 1fr;
  }

  .access-header {
    display: grid;
  }

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

  .nav-item {
    font-size: 0.92rem;
  }

  .stepper {
    display: none;
  }

  .mobile-step-header {
    display: block;
  }

  .form-grid,
  .choice-grid,
  .creative-preview,
  .estimate-panel,
  .kpi-grid,
  .partner-grid,
  .report-bands,
  .variant-grid,
  .chat-input {
    grid-template-columns: 1fr;
  }

  .chat-message {
    width: 100%;
  }

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

  .wizard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .wizard-actions .primary {
    grid-column: 1 / -1;
  }
}
