.widget-builder { max-width: 1020px; }
.widget-builder-intro { margin-bottom: 24px; }
.widget-builder-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.widget-builder-panel, .widget-preview-panel { min-width: 0; }
.widget-builder-panel h2, .widget-preview-panel h2 { margin-top: 0; font-size: 1.2rem; }
.widget-builder-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.widget-builder-options .field { min-width: 0; }
.widget-builder-options input, .widget-builder-options select { width: 100%; }
.widget-builder-hint { margin: 14px 0 0; color: var(--muted); font-size: .88rem; }
.widget-preview-frame { display: grid; place-items: start center; min-height: 280px; padding: 14px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: repeating-conic-gradient(#eef2f8 0 25%, #fff 0 50%) 50% / 18px 18px; }
.widget-preview-frame iframe { display: block; max-width: 100%; border: 1px solid #9fb2cf; border-radius: 8px; background: #fff; }
.widget-code-label { display: block; margin-top: 16px; font-weight: 800; }
.widget-code { width: 100%; min-height: 108px; margin-top: 7px; padding: 12px; resize: vertical; border: 1px solid #263c60; border-radius: 9px; background: #101927; color: #eff6ff; font: .82rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.widget-builder-status { min-height: 1.7em; margin: 8px 0 0; color: var(--primary-dark); font-weight: 700; }
.widget-builder-status.is-error { color: #9e2d35; }
.widget-builder-notice { margin: 18px 0 0; }
.widget-embed-shell { width: 100%; max-width: 100%; min-height: 100vh; padding: 12px; background: var(--bg); color: var(--text); }
.widget-embed-card { width: 100%; max-width: 560px; margin: 0 auto; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 18px rgba(24, 42, 75, .08); }
.widget-embed-card h1 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: -.02em; }
.widget-embed-card p { margin: 0 0 10px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.widget-embed-card form { display: grid; gap: 9px; }
.widget-embed-card label { font-weight: 800; font-size: .9rem; }
.widget-embed-card textarea { width: 100%; min-height: 76px; resize: vertical; }
.widget-embed-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.widget-embed-actions .button { padding: 8px 11px; font-size: .86rem; }
.widget-embed-status { min-height: 1.45em; margin: 7px 0 0 !important; color: var(--primary-dark) !important; font-weight: 700; }
.widget-embed-status.is-error { color: #9e2d35 !important; }
.widget-embed-result { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.widget-embed-result[hidden], .widget-embed-fallback[hidden] { display: none; }
.widget-embed-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 0 0 10px; }
.widget-embed-metric { min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-muted); }
.widget-embed-metric dt { color: var(--muted); font-size: .76rem; }
.widget-embed-metric dd { margin: 1px 0 0; color: var(--text); font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.widget-embed-fallback { margin-top: 9px; }
.widget-embed-fallback textarea { width: 100%; min-height: 74px; margin-top: 5px; font-size: .82rem; }
.widget-qr-canvas-wrap { display: grid; place-items: center; min-height: 150px; margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.widget-qr-canvas-wrap canvas { display: block; width: min(100%, 256px); height: auto; image-rendering: pixelated; }
.widget-embed-meta { margin: 0 0 9px !important; font-size: .78rem !important; }
.widget-theme-dark { --bg: #101927; --surface: #19263a; --surface-muted: #22334d; --text: #edf4ff; --muted: #b5c4d9; --line: #3b5274; --primary: #78aefc; --primary-dark: #b9d4ff; }
.widget-theme-dark .widget-embed-card { box-shadow: 0 6px 18px rgba(0, 0, 0, .24); }
.widget-theme-dark .widget-embed-actions .button { color: #0e2039; background: #a9c9ff; }
.widget-theme-dark .widget-embed-actions .button.secondary { color: var(--text); background: #2d4262; }
.widget-theme-ink { --bg: #f5f0e7; --surface: #fffdf8; --surface-muted: #f0e9da; --text: #252019; --muted: #6d6255; --line: #d8cbb8; --primary: #8e4d24; --primary-dark: #713919; }
@media (max-width: 760px) {
  .widget-builder-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .widget-builder-options { grid-template-columns: 1fr; }
  .widget-embed-shell { padding: 7px; }
  .widget-embed-card { padding: 11px; }
}
