:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --ink: #17211e;
  --muted: #66736f;
  --line: #d8dfdb;
  --line-strong: #c5d0cb;
  --accent: #0f766e;
  --accent-dark: #0a5d57;
  --accent-soft: #e4f3ef;
  --warning: #a85f00;
  --warning-bg: #fff7e8;
  --shadow: 0 18px 42px rgba(23, 33, 30, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.is-hidden {
  display: none !important;
}

.auth-screen {
  align-items: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.auth-card {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  margin: 0 auto;
  max-width: 1120px;
}

.auth-copy,
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-copy {
  align-content: center;
  display: grid;
}

.auth-panel {
  display: grid;
  gap: 16px;
}

.auth-tabs {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
}

.auth-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
}

.auth-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.auth-form {
  display: none;
  gap: 14px;
}

.auth-form.active {
  display: grid;
}

.auth-note {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0;
}

.demo-banner {
  background: var(--warning-bg);
  border: 1px solid #efc779;
  border-radius: 8px;
  color: #704600;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 0;
  padding: 10px 12px;
}

.trade-home {
  min-height: 100vh;
  padding: 48px 16px;
}

.trade-home-inner {
  margin: 0 auto;
  max-width: 1080px;
}

.trade-home h1 {
  max-width: 760px;
}

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

.trade-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  text-align: left;
}

.trade-card:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}

.trade-card strong {
  font-size: 1.18rem;
}

.trade-card span {
  color: var(--muted);
  line-height: 1.4;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  min-height: 64px;
  width: min(1280px, calc(100% - 32px));
}

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

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

.social-auth {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 1rem;
}

.brand-lockup span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(380px, 1.05fr);
  gap: 22px;
  margin: 0 auto;
  padding: 24px 0 40px;
  width: min(1280px, calc(100% - 32px));
}

.workspace,
.result-panel {
  display: grid;
  gap: 16px;
}

.workspace {
  align-content: start;
}

.brand-bar,
.settings-panel,
.form-section,
.launch-stage-panel,
.output-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-bar {
  padding: 22px;
}

.brand-bar h1 {
  font-size: clamp(1.85rem, 3vw, 2.7rem);
  line-height: 1.04;
}

.brand-bar .lead {
  margin-top: 10px;
}

.eyebrow,
.step-label {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  max-width: 720px;
}

h2 {
  font-size: 1.12rem;
}

h3 {
  font-size: 1rem;
}

.lead {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 14px 0 0;
  max-width: 620px;
}

.section-note {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 10px 0 0;
}

.status-pill {
  background: #fff7e8;
  border: 1px solid #efc779;
  border-radius: 999px;
  color: #704600;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 8px 12px;
  white-space: nowrap;
}

.quote-form {
  display: grid;
  gap: 16px;
}

.step-page {
  display: none;
}

.step-page.active {
  display: block;
}

.step-controls {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.wizard-progress {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.settings-panel,
.form-section,
.launch-stage-panel,
.output-card {
  padding: 18px;
}

summary {
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  list-style: none;
  margin-bottom: 16px;
}

summary::-webkit-details-marker {
  display: none;
}

summary span {
  font-weight: 800;
}

summary small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.section-heading,
.panel-header,
.mini-header,
.action-strip,
.action-strip > div,
.button-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.section-heading,
.panel-header,
.mini-header,
.action-strip {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: 14px;
}

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

.stage-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 5px;
  min-height: 104px;
  padding: 12px;
  text-align: left;
}

.stage-card:hover,
.stage-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
}

.stage-card span {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stage-card strong {
  font-size: 1.04rem;
}

.stage-card small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.stage-content {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 12px;
  padding: 14px;
}

.stage-content strong {
  color: var(--ink);
}

.stage-content form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.stage-content p {
  margin: 0;
}

.stage-content ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.plan-action {
  margin-top: 12px;
}

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

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

.field-help {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

input,
select,
textarea {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  width: 100%;
}

textarea {
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.template-row,
.message-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-row {
  margin-top: 14px;
}

.custom-job-wrap {
  display: none;
  margin-top: 14px;
}

.custom-job-wrap.visible {
  display: grid;
}

.job-cost-grid {
  margin-top: 14px;
}

button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 850;
  padding: 12px 16px;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.secondary,
.chip,
.tab,
.ghost {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.secondary:hover,
.ghost:hover {
  background: #eef4f1;
}

.ghost {
  color: var(--muted);
}

.chip,
.tab {
  padding: 9px 12px;
}

.chip:hover,
.chip.active,
.tab:hover,
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.small {
  padding: 9px 12px;
}

.tiny {
  font-size: 0.8rem;
  padding: 7px 10px;
}

.api-status {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: -4px 0 0;
}

.result-panel {
  align-self: start;
  position: sticky;
  top: 88px;
}

.primary-output {
  padding: 20px;
}

.quote-card {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
  margin-top: 18px;
  max-height: 460px;
  min-height: 320px;
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
}

.warning-box {
  background: var(--warning-bg);
  border-color: #f0cf94;
}

.warning-box ul {
  color: var(--warning);
  line-height: 1.45;
  margin: 10px 0 0;
  padding-left: 20px;
}

.message-tabs {
  margin-top: 14px;
}

.message-panel p,
.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.message-panel p {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0 0;
  padding: 14px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.history-item {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.history-item:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.history-item strong {
  color: var(--ink);
  display: block;
  font-size: 0.92rem;
}

.history-item span {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  margin-top: 4px;
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .workspace,
  .panel-header,
  .warning-box,
  .message-panel,
  .history-panel {
    display: none;
  }

  .app-shell {
    display: block;
    padding: 0;
    width: 100%;
  }

  .result-panel,
  .output-card,
  .quote-card {
    border: 0;
    box-shadow: none;
    max-height: none;
    padding: 0;
  }
}

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

  .result-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar-inner,
  .app-shell {
    width: min(100% - 20px, 1280px);
  }

  .topbar-inner,
  .topbar-actions,
  .section-heading,
  .panel-header,
  .mini-header,
  .action-strip,
  .action-strip > div,
  .button-row,
  .template-row,
  .message-tabs {
    align-items: stretch;
    flex-direction: column;
  }

  .two {
    grid-template-columns: 1fr;
  }

  .brand-bar,
  .settings-panel,
  .form-section,
  .launch-stage-panel,
  .output-card {
    padding: 16px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .trade-grid {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
