@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Source+Sans+3:wght@400;600&display=swap');

:root{
  --ink:#0f172a;
  --muted:#64748b;
  --brand:#0ea5e9;
  --brandDark:#0369a1;
  --paper:#f8fafc;
  --card:#ffffff;
  --border:#e2e8f0;
  --accent:#f97316;
  --radius:14px;
  --shadow:0 18px 40px rgba(15, 23, 42, 0.12);
  --demoBannerH:34px;
}

* { box-sizing: border-box; }
html, body { width: 100%; }
body {
  margin: 0; padding: 0;
  font-family: "Source Sans 3", Arial, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(1200px 500px at 10% -10%, #e0f2fe 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #ffedd5 0%, transparent 55%),
    var(--paper);
}
body.theme-dark {
  --ink:#e2e8f0;
  --muted:#94a3b8;
  --brand:#38bdf8;
  --brandDark:#0ea5e9;
  --paper:#0b1220;
  --card:#0f172a;
  --border:#1e293b;
  --accent:#fb923c;
  --shadow:0 18px 40px rgba(2, 6, 23, 0.6);
  background:
    radial-gradient(1200px 500px at 10% -10%, #0b1220 0%, transparent 60%),
    radial-gradient(900px 400px at 100% 0%, #1f2937 0%, transparent 55%),
    var(--paper);
}

body.font-large {
  font-size: 18px;
}

body.font-large .titleBlock h1 { font-size: 32px; }
body.font-large .titleBlock p { font-size: 17px; }
body.font-large h3 { font-size: 20px; }
body.font-large h4 { font-size: 16px; }
body.font-large .contextTitle { font-size: 18px; }
body.font-large .contextBody { font-size: 16px; }
body.font-large .progressLabel { font-size: 14px; }
body.font-large .stepDot { font-size: 14px; }
body.font-large label { font-size: 15px; }
body.font-large .hint { font-size: 14px; }
body.font-large input,
body.font-large select,
body.font-large textarea { font-size: 16px; }
body.font-large .check { font-size: 14px; }

.check a {
  color: var(--brandDark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.theme-dark .check a {
  color: var(--brand);
}

.demo-banner {
  display: none;
}

body.is-demo .demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--demoBannerH) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  font-family: "Space Grotesk", Arial, sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  user-select: none;
}

body.is-demo .wrap {
  padding-top: calc(24px + var(--demoBannerH) + env(safe-area-inset-top));
}

.wrap {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 24px 16px 36px;
}
.hero {
  display:flex; justify-content:space-between; align-items:center; gap:18px;
  margin-bottom: 22px;
}
.widget-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.brandRow {
  display:flex;
  align-items:center;
  gap:14px;
}
.titleBlock h1 {
  margin: 0 0 6px; font-size: 28px;
  font-family: "Space Grotesk", Arial, sans-serif;
}
.titleBlock p { margin:0; color:var(--muted); font-size: 15px; }

.themeToggle {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}
body.theme-dark .themeToggle {
  background: #0b1220;
  border-color: #334155;
  color: #e2e8f0;
}

.card {
  background: var(--card);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 18px;
}

.intro {
  background: #0ea5e91a;
  border:1px solid #bae6fd;
  padding: 14px 16px;
  border-radius: 12px;
  color: #075985;
  margin-bottom: 16px;
  font-weight: 600;
}
body.theme-dark .intro {
  background: #0ea5e91a;
  border:1px solid #1d4ed8;
  color: #e2e8f0;
}

.contextBox {
  border:1px dashed var(--border);
  background:#1f3a36;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  color:#e6f3ee;
  border-color:#3f5d57;
}
.contextTitle {
  font-weight:700;
  font-size:16px;
  margin-bottom:4px;
}
.contextBody {
  color:#cfe7de;
  font-size:14px;
  font-weight:600;
}
body.theme-dark .contextBox {
  background:#eef7f2;
  border-color:#c5d6ce;
  color:#1f2b37;
}
body.theme-dark .contextBody {
  color:#4b6157;
}

body.widget-fullscreen .contextBox {
  position: sticky;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 20;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.progressWrap { margin-bottom: 18px; }
.progressLabel { display:flex; justify-content:space-between; font-size:13px; color:var(--muted); }
.progressBar {
  height:10px; background:#e2e8f0; border-radius:999px; overflow:hidden; margin-top:6px;
}
body.theme-dark .progressBar { background:#1f2937; }
.progressFill { height:100%; width:0%; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width 0.3s ease; }

.steps { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.stepDot {
  border:1px solid var(--border); border-radius:999px; padding:4px 10px; font-size:12px;
  color:var(--muted);
}
.stepDot.active { background:#0ea5e91a; border-color:#38bdf8; color:#075985; font-weight:600; }
body.theme-dark .stepDot { color:#94a3b8; }
body.theme-dark .stepDot.active { color:#e2e8f0; }

.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display:block; font-weight:600; margin-top:10px; }
.hint { font-size:12px; color:var(--muted); margin-top:6px; }

input, select, textarea {
  width:100%; padding:10px 12px; margin-top:6px;
  border-radius: 10px; border:1px solid var(--border);
  font-size:14px; background:#fff;
}
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background:#0b1220;
  color: var(--ink);
  border-color:#334155;
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
  color:#94a3b8;
}
textarea { min-height:90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus {
  outline: 3px solid rgba(14, 165, 233, 0.35);
  outline-offset: 2px;
}

.checks { display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.check {
  display:flex; align-items:center; gap:8px; padding:8px 12px;
  border:1px solid var(--border); border-radius:999px; font-size:13px;
  background:#f8fafc;
}
body.theme-dark .check {
  background:#111827;
  border-color:#334155;
  color:#e2e8f0;
}
.check input { width:auto; margin:0; }
.hidden { display:none; }
input[type="checkbox"],
input[type="radio"] { accent-color: var(--brand); }

.disclosure {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
}
.disclosureSummary {
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:14px;
  font-weight:700;
  color: var(--ink);
  cursor: pointer;
}
.disclosureSummary::-webkit-details-marker { display:none; }
.disclosureSummary::after {
  content: "+";
  font-size: 12px;
  color: var(--muted);
}
details[open] > .disclosureSummary::after { content: "-"; }
.disclosure > .checks { margin-top: 8px; }
body.theme-dark .disclosure {
  background:#0b1220;
  border-color:#1e293b;
}
body.theme-dark .disclosureSummary { color:#e2e8f0; }

.navRow { display:flex; justify-content:space-between; gap:10px; margin-top: 18px; }
button {
  padding: 12px 16px; border:0; border-radius: 12px; cursor:pointer;
  background: var(--brand); color:#fff; font-weight:700; font-size:14px;
}
button.secondary { background:#0f172a; }
button.ghost { background:#e2e8f0; color:#0f172a; }
button:disabled { opacity:0.6; cursor:not-allowed; }

.panel { display:none; }
.panel.active { display:block; }

.divider { height:1px; background:var(--border); margin: 16px 0; }
.error { color:#b91c1c; font-weight:700; margin-top:10px; display:none; }

.quoteModal[hidden] { display:none !important; }
.quoteModal {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.quoteModalBackdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(2, 6, 23, 0.62);
  cursor: pointer;
}
.quoteModalDialog {
  position: relative;
  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  z-index: 1;
}
.quoteModalDialog .quoteCard {
  margin-top: 0;
}
.quoteModalClose {
  position: sticky;
  top: 10px;
  float: right;
  z-index: 2;
  margin: 10px 10px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
}
body.quote-modal-open {
  overflow: hidden;
}
.quoteCard { margin-top:18px; display:none; }
#quoteCard #payloadWrap { display: none !important; }
.quoteTop { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.quotePrice { font-size:28px; font-weight:800; }
.quotePkg { font-size:16px; font-weight:700; margin:0; }
.quoteMeta { margin:6px 0 0; color:var(--muted); font-size:13px; }
.quoteActions { display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin-top:12px; }
.quoteCta {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 16px;
  border-radius: 12px;
  cursor:pointer;
  background: var(--brand);
  color:#fff;
  font-weight:800;
  font-size:14px;
  text-decoration:none;
  border:0;
}
.quoteCta.secondary {
  background:#0f172a;
  color:#fff;
  font-weight:700;
  border:0;
}
.quoteBreakdown {
  margin-top:12px;
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.quoteBreakdown ul {
  margin:0;
  padding-left:18px;
  display:grid;
  gap:4px;
}
.pill { display:inline-block; padding:6px 10px; border-radius:999px; background:#f1f5f9; color:#0f172a; margin-top:10px; font-size:12px; }
.pill:empty { display:none !important; }
.pill.warning {
  background:#fff7ed;
  color:#9a3412;
  border:1px solid #fdba74;
}
.quoteBreakdown:empty { display:none !important; }
.payloadTable {
  width:100%;
  border-collapse: collapse;
  margin-top:10px;
  font-size:13px;
}
.payloadTable th, .payloadTable td {
  border:1px solid var(--border);
  padding:8px 10px;
  vertical-align: top;
}
.payloadTable th {
  text-align:left;
  background:#f1f5f9;
  font-weight:700;
}
.payloadTable tr:nth-child(even) td { background:#fafafa; }
body.theme-dark .payloadTable th {
  background:#0b1220;
  color:#e2e8f0;
}
body.theme-dark .payloadTable td {
  background:#0f172a;
  color:#e2e8f0;
}
body.theme-dark .payloadTable tr:nth-child(even) td {
  background:#111827;
}
body.theme-dark .quoteModalBackdrop {
  background: rgba(2, 6, 23, 0.78);
}
body.theme-dark .quoteModalClose {
  background:#334155;
}

@media (min-width: 721px) {
  details.disclosure:not([open]) > *:not(summary) { display: block; }
  .disclosure {
    padding: 0;
    border: 0;
    background: transparent;
  }
  .disclosureSummary { display: none; }
}

@media (max-width: 720px) {
  body { padding: 0; }
  .wrap { padding: 18px 10px 28px; }
  .card { padding: 14px; border: 0; box-shadow: none; }
  .titleBlock h1 { font-size: 22px; }
  .titleBlock p { font-size: 14px; }
  .progressLabel { flex-direction: column; gap: 4px; }
  .steps { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .stepDot { white-space: nowrap; }
  .contextBox { padding: 10px 12px; border: 0; background: #1f3a36; color:#e6f3ee; }
  body.theme-dark .contextBox { background: #eef7f2; color:#1f2b37; }
  body.theme-dark .contextBody { color:#4b6157; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  label { margin-top: 6px; }
  input, select, textarea { font-size: 16px; padding: 12px; border-radius: 12px; }
  .checks { display: grid; grid-template-columns: 1fr; gap: 0; }
  .check { border: 0; border-radius: 0; background: transparent; padding: 10px 4px; box-shadow: inset 0 -1px 0 var(--border); }
  .checks .check:last-child { box-shadow: none; }
  .disclosure { padding: 8px 10px; }
  .disclosureSummary { font-size: 13px; }
  .quoteTop { flex-direction: column; align-items: flex-start; }
  .quotePrice { font-size: 24px; }
  .payloadTable { display: block; overflow-x: auto; white-space: nowrap; }
  .quoteModal { padding: 8px; }
  .quoteModalDialog {
    width: min(980px, calc(100vw - 10px));
    max-height: calc(100vh - 10px);
  }
  .quoteModalClose {
    top: 6px;
    margin: 6px 6px 0 0;
  }
}

@media (max-width: 520px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .brandRow {
    width: 100%;
  }
  .widget-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .widget-controls .themeToggle {
    flex: 1 1 150px;
  }
  .navRow {
    flex-direction: column;
  }
  .navRow button {
    width: 100%;
  }
}
