:root {
  --primary: #1a56db;
  --secondary: #4b5563;
  --radius: 8px;
  --border: #e5e7eb;
  --bg: #f9fafb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #111827;
  background: var(--bg);
  line-height: 1.5;
}

header.site {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

header.site strong { color: var(--primary); }

header.site nav a {
  color: var(--secondary);
  text-decoration: none;
  margin-right: 16px;
  font-size: 14px;
}

header.site nav a:hover { color: var(--primary); }

main { max-width: 1080px; margin: 0 auto; padding: 24px; }

.cx-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
  margin-bottom: 20px;
}

.cx-panel h1 { margin: 0 0 4px; font-size: 22px; }
.cx-panel h2 { margin: 0 0 4px; font-size: 18px; }
.cx-panel h3 { margin: 20px 0 6px; font-size: 15px; }

.cx-panel-search { border-top: 3px solid var(--primary); }

.cx-form { max-width: 100%; }
.cx-form-inline {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px 14px;
  align-items: end;
}
.cx-form-inline button { margin-top: 0; height: 40px; }
.cx-form-inline .cx-field-check { grid-column: 1 / 3; display: flex; gap: 18px; align-items: center; }

.cx-form-wide { max-width: 640px; }
.cx-field { display: flex; flex-direction: column; }
.cx-field label { font-size: 12px; color: var(--secondary); margin-bottom: 4px; }
.cx-field input[type="text"],
.cx-field input[type="email"],
.cx-field input[type="tel"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-size: 14px;
}

.cx-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }

.cx-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }

.cx-form button,
.cx-actions button,
.cx-compare-bar button {
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}

.cx-actions { margin-top: 16px; }
.cx-actions button { margin-right: 8px; }
.cx-actions button[disabled],
.cx-compare-bar button[disabled] { background: #9ca3af; cursor: not-allowed; }

.cx-btn-ghost { background: #fff !important; color: var(--secondary) !important; border: 1px solid #d1d5db !important; }

.cx-link {
  background: none !important;
  color: var(--primary) !important;
  border: 0 !important;
  padding: 0 !important;
  font-size: 13px !important;
  text-decoration: underline;
  cursor: pointer;
}

.cx-results-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.cx-results-head .cx-link { margin-left: auto; }

.cx-compare-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--secondary);
}

.cx-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cx-step {
  font-size: 12px;
  color: var(--secondary);
  background: #f3f4f6;
  border: 0;
  border-radius: 999px;
  padding: 5px 14px;
  font-family: inherit;
}
.cx-step:not([disabled]):hover { color: var(--primary); }
.cx-step-active { background: var(--primary); color: #fff; font-weight: 600; }
.cx-step-done { background: #ecfdf5; color: #047857; font-weight: 600; }
.cx-step[disabled] { opacity: .5; cursor: not-allowed; }

.cx-group { margin-bottom: 26px; }

.cx-group-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cx-group-id { display: flex; align-items: baseline; gap: 8px; }
.cx-group-id h3 { margin: 0; font-size: 16px; }
.cx-group-id span { font-size: 12px; }

.cx-group-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.cx-group-meta .cx-stat { background: #f3f4f6; color: #374151; }
.cx-group-meta .cx-stat.cx-stat-off { background: #f3f4f6; color: #6b7280; }
.cx-group-meta .cx-stat.cx-stat-run { background: #eff6ff; color: #1d4ed8; }

.cx-vertical-head { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--secondary); font-weight: 700; margin: 14px 0 4px; }

.cx-attr-list { margin: 0 0 6px; padding-left: 18px; font-size: 13px; color: #374151; }
.cx-attr-list li { margin: 2px 0; }

.cx-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.cx-stat {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
}
.cx-stat-run { background: #eff6ff; color: #1d4ed8; }
.cx-stat-off { background: #f3f4f6; color: #6b7280; }
.cx-stat-err { background: #fef2f2; color: #b91c1c; }

.cx-accordion { display: grid; gap: 8px; margin-bottom: 8px; }
.cx-accordion details {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.cx-accordion summary { cursor: pointer; font-size: 13px; color: var(--secondary); font-weight: 600; }
.cx-accordion summary:hover { color: var(--primary); }

.cx-address-list { display: grid; gap: 8px; margin: 12px 0; }
.cx-address {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
}
.cx-address:hover { border-color: var(--primary); }
.cx-address span { display: flex; flex-direction: column; }
.cx-address small { color: var(--secondary); font-size: 12px; }

.cx-custom-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  background: #fcfcfd;
}
.cx-custom-block h3 { margin-top: 0; }
/* live integration pages (real bundle) */
.cx-live { background: #f3f4f6; padding-bottom: 80px; }
.live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 20px 8px;
}
.live-head h1 { font-size: 20px; margin: 0 0 2px; }
.live-badges { display: flex; gap: 8px; }
.live-main { max-width: 900px; margin: 0 auto; padding: 12px 20px; }
.live-main [name="cortecx-address-container"],
.live-main [name="cortecx-buyflow-container"] {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 120px;
}
.live-note { margin-top: 16px; font-size: 12px; }
.live-note code { background: #eef2ff; padding: 1px 5px; border-radius: 4px; }
.cx-error-box { border-left: 4px solid #dc2626; padding-left: 14px; }
.cx-error-box h2 { color: #dc2626; font-size: 16px; margin: 0 0 8px; }
.cx-error-box p { font-size: 13px; color: var(--secondary); margin: 0 0 6px; }
.cx-error-box code { background: #fee2e2; padding: 1px 5px; border-radius: 4px; }

.cx-field-block { margin-top: 14px; }
.cx-field-wide { grid-column: 1 / -1; }
.cx-field-block > label { display: block; font-size: 13px; color: var(--secondary); margin-bottom: 6px; font-weight: 600; }

.cx-radio-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-radio-pill {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  background: #fff;
  font-size: 13px;
}
.cx-radio-pill:hover { border-color: var(--primary); }
.cx-radio-pill input { margin-top: 3px; }
.cx-radio-pill:has(input:checked) {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px var(--primary);
}
.cx-radio-pill span { display: flex; flex-direction: column; }
.cx-radio-pill small { color: var(--secondary); font-size: 11px; }

.cx-codes { margin: 14px 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: #f9fafb; }
.cx-codes > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--secondary); }
.cx-codes > summary:hover { color: var(--primary); }
.cx-codes details { margin: 10px 0 0; }
.cx-codes details > summary { font-size: 12px; }
.cx-codes td { font-size: 13px; }
.cx-field-block select,
.cx-field-block input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
}

.cx-radios { display: grid; gap: 6px; }

.cx-addon {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
  max-width: 520px;
}
.cx-addon:hover { border-color: var(--primary); }
.cx-addon span { display: flex; flex-direction: column; }
.cx-addon small { color: var(--secondary); font-size: 12px; }

.cx-row-child td { color: var(--secondary); font-size: 13px; background: #fafafa; }

.cx-confirm {
  border: 1px solid var(--border);
  border-left: 3px solid #059669;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.cx-confirm-failed { border-left-color: #dc2626; }
.cx-confirm-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }

.cx-msg { margin-top: 10px; font-size: 13px; }
.cx-msg p { margin: 4px 0 0; color: #374151; }

.cx-fail { color: #b91c1c; font-weight: 600; }

.cx-badge-addtocart { background: #ecfdf5; color: #047857; }
.cx-badge-redirectwebsite { background: #eff6ff; color: #1d4ed8; }
.cx-badge-chooseaddress { background: #fef3c7; color: #92400e; }

.cx-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.cx-modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 22px 24px;
  max-width: 860px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
}

.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.cx-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.cx-card h4 { margin: 0 0 6px; font-size: 15px; }
.cx-card-top { display: flex; gap: 8px; margin-bottom: 8px; }

.cx-badge {
  background: #eef2ff;
  color: var(--primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.cx-badge-alt { background: #f3f4f6; color: var(--secondary); }

.cx-price { font-weight: 700; font-size: 16px; margin: 8px 0 0; }
.cx-muted { color: var(--secondary); font-size: 13px; margin: 0; }

.cx-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.cx-table th, .cx-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.cx-table th { background: #f3f4f6; font-weight: 600; }

.cx-totals { text-align: right; margin-top: 12px; }
.cx-grand { font-size: 18px; font-weight: 700; }
.cx-success { color: #047857; font-weight: 600; }

.hint {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: #78350f;
  margin-bottom: 20px;
}
