:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dce5;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --brand: #0f766e;
  --accent: #7c3aed;
  --focus: #0891b2;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.rail {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px 12px;
  border-right: 1px solid var(--line);
  background: #0b1220;
}

.brand-mark,
.rail-button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.brand-mark {
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.rail-button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
}

.rail-button.active {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.workspace {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 0.82rem;
  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(2rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-dot.ok {
  background: var(--brand);
}

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

.status-dot.loading {
  background: #f59e0b;
  animation: dazl-pulse 1.2s ease-in-out infinite;
}

@keyframes dazl-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.selection-note {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.85rem;
  line-height: 1.4;
}

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

.canvas-panel,
.properties,
.checkout,
.selection-empty,
.selection-card,
.offer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.canvas-panel {
  min-height: 520px;
  padding: 18px;
}

.properties {
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-heading strong {
  color: var(--brand);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metrics-grid article {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
}

.metrics-grid span,
.offer p,
.fine-print {
  color: var(--muted);
}

.metrics-grid strong {
  display: block;
  margin-top: 22px;
  font-size: 2.1rem;
}

.pipeline {
  display: grid;
  gap: 12px;
}

.pipeline div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.pipeline b {
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.pipeline div:nth-child(2) b {
  width: 82%;
}

.pipeline div:nth-child(3) b {
  width: 68%;
}

.pipeline div:nth-child(4) b {
  width: 44%;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkout {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 22px;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
}

.checkout h2 {
  font-size: 1.15rem;
}

.offers {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.offer {
  display: grid;
  gap: 8px;
  padding: 14px;
  box-shadow: none;
}

.offer strong {
  font-size: 1rem;
}

.offer button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.price {
  font-weight: 800;
  color: var(--accent);
}

.selection-empty,
.selection-card {
  min-height: 110px;
  margin: 14px 0;
  padding: 14px;
  box-shadow: none;
}

.selection-empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
}

.primary-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #9ca3af;
}

.fine-print {
  margin: 14px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 1060px) {
  .product-shell {
    grid-template-columns: 64px 1fr;
  }

  .checkout {
    position: static;
    grid-column: 2;
    min-height: auto;
    margin: 0 28px 28px;
    border-left: 1px solid var(--line);
    border-radius: 8px;
  }
}

@media (max-width: 820px) {
  .product-shell,
  .builder {
    grid-template-columns: 1fr;
  }

  .rail {
    grid-template-columns: repeat(4, 48px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .checkout {
    grid-column: 1;
    margin: 0 18px 18px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
}


.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
}

.legal-footer a,
.back-link {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.legal-page {
  width: min(720px, calc(100% - 36px));
  margin: 0 auto;
  padding: 48px 0;
  line-height: 1.7;
}

.legal-page h1 {
  margin: 18px 0;
  font-size: 2rem;
}

.auth-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}

.auth-panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.auth-grid {
  display: grid;
  gap: 10px;
}

.auth-grid label {
  display: grid;
  gap: 5px;
  font-size: 0.85rem;
  color: inherit;
}

.auth-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.9);
}

.auth-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.auth-actions button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 0.85rem;
}

.auth-status[data-state="error"] {
  color: #b91c1c;
}

.auth-status[data-state="ok"] {
  color: #047857;
}
