/* FormsBat app pages: dashboard, template gallery, builder and responses. Uses the design tokens from app.css. */

/* ---------- dashboard ---------- */
.fx-usage[hidden] { display: none; }
.fx-usage { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; color: var(--text-2); }
.fx-usage .meter { flex: 1; min-width: 140px; max-width: 220px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.fx-usage .meter span { display: block; height: 100%; background: var(--accent); }
.fx-usage a { font-weight: 600; }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.fx-card { display: flex; flex-direction: column; overflow: hidden; transition: border-color .12s, box-shadow .12s; position: relative; }
.fx-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.fx-card .stripe { height: 6px; background: var(--c, var(--accent)); }
.fx-card .body { padding: 16px 18px 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.fx-card h3 { margin: 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.fx-card h3 a { color: var(--text); }
.fx-card .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.fx-card .count { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--text); line-height: 1; }
.fx-card .count small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 6px; letter-spacing: 0; }
.fx-card .foot { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.fx-card .foot .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.fx-card .foot .grow { flex: 1; }
.badge.open { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge.closed { background: var(--surface-3); color: var(--muted); border-color: transparent; }
.fx-menu { position: relative; }
.fx-menu .menu { right: 0; left: auto; top: auto; bottom: calc(100% + 6px); min-width: 180px; }
.fx-start { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .fx-start { grid-template-columns: 1fr; } }
.fx-start button, .fx-start a { text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.fx-start button:hover, .fx-start a:hover { border-color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.fx-start .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.fx-start b { font-size: 15px; }
.fx-start span { font-size: 13px; color: var(--muted); }
.fx-empty { padding: 40px 28px; text-align: center; }
.fx-empty h2 { margin-bottom: 6px; }
.fx-empty p { color: var(--muted); margin-bottom: 22px; }
.fx-ai textarea { min-height: 120px; font-size: 15px; }
.fx-ai .examples { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.fx-ai .examples button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.fx-ai .examples button:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---------- template gallery ---------- */
.tg-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.tg-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.tg-cats button { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.tg-cats button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tg-card { display: flex; flex-direction: column; overflow: hidden; }
.tg-thumb { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; border-bottom: 1px solid var(--border); position: relative; }
.tg-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .25s; }
.tg-card:hover .tg-thumb img { transform: scale(1.03); }
.tg-meta { padding: 14px 16px 6px; flex: 1; }
.tg-meta b { display: block; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.tg-meta p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tg-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tg-tags span { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tg-acts { display: flex; gap: 8px; padding: 12px 16px 16px; }
.tg-acts .btn { flex: 1; }

/* ---------- builder ---------- */
.fb-app-page { background: var(--bg); }
.bx-top { position: sticky; top: var(--header-h); z-index: 40; background: var(--surface); border-bottom: 1px solid var(--border); }
.bx-top-inner { display: flex; align-items: center; gap: 12px; padding: 10px 20px; flex-wrap: wrap; }
.bx-title { flex: 1; min-width: 160px; display: flex; align-items: center; gap: 8px; }
.bx-title input { font-size: 17px; font-weight: 650; border-color: transparent; box-shadow: none; background: transparent; height: 38px; padding: 0 8px; min-width: 0; }
.bx-title input:hover { border-color: var(--border); }
.bx-saved { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bx-tabs { display: flex; gap: 2px; padding: 0 16px; overflow-x: auto; scrollbar-width: none; }
.bx-tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 550; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.bx-tabs button.active { color: var(--accent-text); border-color: var(--accent); }
.bx-main { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(360px, 440px); gap: 0; min-height: calc(100vh - var(--header-h) - 100px); }
.bx-main.no-palette { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
.bx-palette { border-right: 1px solid var(--border); background: var(--surface); padding: 16px 12px; position: sticky; top: calc(var(--header-h) + 98px); align-self: start; max-height: calc(100vh - var(--header-h) - 100px); overflow: auto; }
.bx-palette h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 6px 8px; }
.bx-palette button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; background: none; border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--text-2); cursor: grab; text-align: left; }
.bx-palette button:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.bx-palette button .i { color: var(--accent-text); }
.bx-canvas { padding: 24px; min-width: 0; }
.bx-canvas-inner { max-width: 760px; margin: 0 auto; }
.bx-panel { border-left: 1px solid var(--border); background: var(--surface-2); position: sticky; top: calc(var(--header-h) + 98px); align-self: start; height: calc(100vh - var(--header-h) - 98px); overflow: auto; }
.bx-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 2; font-size: 13px; font-weight: 600; color: var(--text-2); }
.bx-preview-head .segmented button { padding: 4px 10px; }
.bx-preview { min-height: 100%; }
.bx-preview .fb-form { min-height: 100%; }
.bx-preview .fb-shell { padding: 18px 12px; }
.bx-preview.phone .fb-shell { max-width: 390px; }
.bx-preview .fb-header { padding: 26px 26px 6px; }
.bx-preview .fb-head-band .fb-header { padding: 24px 26px; }
.bx-preview .fb-app { padding: 14px 26px 26px; }
.bx-preview .fb-title { font-size: calc(var(--fb-title-size) * .78); }
.bx-preview-toggle { display: none; }
@media (max-width: 1180px) {
  .bx-main, .bx-main.no-palette { grid-template-columns: 200px minmax(0, 1fr); }
  .bx-main.no-palette { grid-template-columns: minmax(0, 1fr); }
  .bx-panel { display: none; position: fixed; inset: var(--header-h) 0 0 auto; width: min(460px, 100%); height: auto; z-index: 60; box-shadow: var(--shadow-lg); }
  .bx-panel.open { display: block; }
  .bx-preview-toggle { display: inline-flex; }
}
@media (max-width: 760px) {
  .bx-main { grid-template-columns: minmax(0, 1fr) !important; }
  .bx-palette { position: fixed; inset: auto 0 0 0; top: auto; max-height: 60vh; z-index: 70; border-right: 0; border-top: 1px solid var(--border); box-shadow: var(--shadow-lg); display: none; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + var(--safe-b)); }
  .bx-palette.open { display: block; }
  .bx-palette .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .bx-canvas { padding: 14px 12px 90px; }
  .bx-top-inner { padding: 8px 12px; gap: 8px; }
  .bx-top-inner .btn .long { display: none; }
  .bx-panel { inset: var(--header-h) 0 0 0; width: 100%; }
}
.bx-add-mobile { display: none; }
@media (max-width: 760px) { .bx-add-mobile { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--tabbar-h) + var(--safe-b)); z-index: 50; } .has-tabbar .bx-add-mobile { bottom: calc(70px + var(--safe-b)); } }

.bx-form-head { padding: 18px 20px; margin-bottom: 14px; display: grid; gap: 8px; }
.bx-form-head textarea { min-height: 60px; }
.bx-list { display: grid; gap: 10px; }
.bx-q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color .12s, box-shadow .12s; position: relative; }
.bx-q:hover { border-color: var(--border-strong); }
.bx-q.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.bx-q.drop-before::before, .bx-q.drop-after::after { content: ""; position: absolute; left: 8px; right: 8px; height: 3px; border-radius: 3px; background: var(--accent); }
.bx-q.drop-before::before { top: -7px; }
.bx-q.drop-after::after { bottom: -7px; }
.bx-q.dragging { opacity: .45; }
.bx-q-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; min-height: 56px; }
.bx-q-row .grip { cursor: grab; color: var(--muted); display: grid; place-items: center; width: 22px; flex: none; }
.bx-q-row .ty { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.bx-q-row .lbl { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-q-row .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.bx-q-row .tags { display: flex; gap: 4px; flex: none; }
.bx-q-row .tags span { font-size: 11px; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); display: inline-flex; gap: 4px; align-items: center; }
.bx-q-row .tags span.logic { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.bx-q.page { background: var(--surface-2); border-style: dashed; }
.bx-q.page .ty { background: var(--text); color: var(--surface); }
.bx-q.section .lbl { font-size: 15.5px; }
.bx-q-edit { border-top: 1px solid var(--border); padding: 16px; display: grid; gap: 12px; }
.bx-q-edit .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bx-q-edit .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .bx-q-edit .row2, .bx-q-edit .row3 { grid-template-columns: 1fr; } }
.bx-q-edit label.field { margin: 0; }
.bx-q-edit .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); padding-top: 12px; }
.bx-q-edit .acts .grow { flex: 1; }
.bx-q-edit details { border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; background: var(--surface-2); }
.bx-q-edit details[open] { padding-bottom: 12px; }
.bx-q-edit summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.bx-logic-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 560px) { .bx-logic-row { grid-template-columns: 1fr 1fr; } }
.bx-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.bx-switch input { width: 34px; height: 20px; appearance: none; -webkit-appearance: none; background: var(--border-strong); border-radius: 99px; position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.bx-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.bx-switch input:checked { background: var(--accent); }
.bx-switch input:checked::after { transform: translateX(14px); }
.bx-empty { text-align: center; padding: 36px 20px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--muted); }

.bx-pane { padding: 24px; max-width: 900px; margin: 0 auto; display: grid; gap: 18px; }
.bx-pane .card { padding: 20px; }
.bx-pane .card h3 { margin: 0 0 4px; }
.bx-pane .card > p.muted { margin: 0 0 16px; font-size: 13.5px; }
.bx-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.bx-theme { border: 2px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--surface); padding: 0; font: inherit; text-align: left; color: var(--text); }
.bx-theme.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.bx-theme .sw { height: 84px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.bx-theme .sw .card-mini { border-radius: 6px; padding: 8px; display: grid; gap: 5px; }
.bx-theme .sw .line { height: 5px; border-radius: 3px; opacity: .35; }
.bx-theme .sw .btnm { height: 10px; width: 46px; border-radius: 3px; }
.bx-theme .nm { padding: 8px 10px 10px; font-size: 13px; font-weight: 600; border-top: 1px solid var(--border); }
.bx-theme .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.bx-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bx-swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.bx-swatches button.active { box-shadow: 0 0 0 2px var(--accent-text); }
.bx-img-pick { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bx-img-pick img { max-height: 48px; max-width: 160px; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.bx-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bx-kind { border: 2px solid var(--border); border-radius: 12px; background: var(--surface); padding: 14px; text-align: left; cursor: pointer; font: inherit; color: var(--text); display: grid; gap: 4px; align-content: start; }
.bx-kind .i { color: var(--accent-text); }
.bx-kind b { font-size: 14px; }
.bx-kind span { font-size: 12.5px; color: var(--muted); }
.bx-kind.active { border-color: var(--accent); background: var(--accent-soft); }
.bx-kind:disabled { opacity: .55; cursor: not-allowed; }
.bx-designs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 700px) { .bx-designs { grid-template-columns: repeat(3, 1fr); } }
.bx-design { border: 2px solid var(--border); border-radius: 10px; padding: 8px; background: #fff; cursor: pointer; display: grid; gap: 6px; font: inherit; }
.bx-design.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.bx-design .pg { aspect-ratio: 1 / 1.25; border: 1px solid #e4e4e7; border-radius: 4px; padding: 7px; display: grid; align-content: start; gap: 4px; background: #fff; }
.bx-design .pg i { display: block; height: 4px; border-radius: 2px; background: #d4d4d8; }
.bx-design .nm { font-size: 12px; font-weight: 600; color: #27272a; text-align: center; }
.bx-map { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bx-map th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.bx-map td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.bx-map td:first-child { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.bx-map tr.unmatched td:first-child { color: var(--warning); }
.bx-map select { height: 34px; }
.bx-pdf-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .bx-pdf-wrap { grid-template-columns: 1fr; } }
.bx-pdf-page { position: relative; border: 1px solid var(--border); background: #fff; cursor: crosshair; user-select: none; }
.bx-pdf-page canvas { display: block; width: 100%; height: auto; }
.bx-box { position: absolute; border: 1.5px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 3px; font-size: 11px; color: var(--accent-text); padding: 1px 4px; overflow: hidden; white-space: nowrap; cursor: move; }
.bx-box.sel { box-shadow: 0 0 0 2px var(--ring); }
.bx-code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; word-break: break-all; }
.bx-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.bx-chips code { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.bx-chips code:hover { border-color: var(--accent); }
.bx-share { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; align-items: start; }
@media (max-width: 760px) { .bx-share { grid-template-columns: 1fr; } }
.bx-qr { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: grid; gap: 8px; justify-items: center; }
.bx-qr img { width: 180px; height: 180px; }
.bx-status { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 16px 20px; }
.bx-signers { display: grid; gap: 8px; }
.bx-signer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
@media (max-width: 560px) { .bx-signer { grid-template-columns: 1fr; } }

/* ---------- responses ---------- */
.rx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.rx-head h1 { margin: 0; font-size: 26px; overflow-wrap: anywhere; }
.rx-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.rx-tools input[type=date] { width: 150px; }
.rx-table-wrap { overflow: auto; max-height: calc(100vh - 300px); max-width: 100%; min-width: 0; }
.rx-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.rx-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; font-size: 12.5px; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.rx-table th button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; padding: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.rx-table th[aria-sort] button { color: var(--accent-text); }
.rx-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top; }
.rx-table tbody tr { cursor: pointer; }
.rx-table tbody tr:hover td { background: var(--surface-2); }
.rx-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rx-drawer { position: fixed; top: var(--header-h); right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 80; display: flex; flex-direction: column; animation: rx-in .18s ease; }
@keyframes rx-in { from { transform: translateX(20px); opacity: 0; } }
.rx-drawer header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.rx-drawer header h2 { margin: 0; flex: 1; font-size: 17px; }
.rx-drawer .content { padding: 18px; overflow: auto; flex: 1; display: grid; gap: 16px; align-content: start; }
.rx-answers { display: grid; gap: 0; }
.rx-answers div { padding: 10px 0; border-bottom: 1px solid var(--border); }
.rx-answers dt { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.rx-answers dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rx-answers img { max-width: 220px; max-height: 90px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.rx-box { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; display: grid; gap: 10px; background: var(--surface-2); }
.rx-box h3 { margin: 0; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.rx-box .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rx-signers { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.rx-signers li { display: flex; justify-content: space-between; gap: 8px; }

/* summary charts */
.sx-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.sx-stat { padding: 16px 18px; }
.sx-stat b { display: block; font-size: 28px; letter-spacing: -.02em; line-height: 1.1; }
.sx-stat span { color: var(--muted); font-size: 13px; }
.sx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.sx-q { padding: 18px 20px; }
.sx-q h3 { font-size: 15px; margin: 0 0 2px; }
.sx-q .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.sx-q svg, .sx-stat svg { display: block; width: 100%; height: auto; overflow: visible; }
.sx-q svg text, .sx-stat svg text { font-family: var(--font); fill: var(--text-2); }
.sx-q svg .val { fill: var(--text); font-weight: 600; }
.sx-q svg .bar, .sx-stat svg .bar { fill: var(--accent); }
.sx-q svg .track, .sx-stat svg .track { fill: var(--surface-3); }
.sx-q svg .prom { fill: #079455; } .sx-q svg .pass { fill: #b9bab1; } .sx-q svg .det { fill: #d92d20; }
.sx-big { display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.sx-big b { font-size: 30px; letter-spacing: -.02em; }
.sx-big span { color: var(--muted); font-size: 13px; }
.sx-texts { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 280px; overflow: auto; }
.sx-texts li { padding: 9px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13.5px; overflow-wrap: anywhere; }
.sx-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.sx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bx-add-mobile[hidden], .bx-palette[hidden] { display: none !important; }
.bx-top, .bx-main { max-width: 100vw; min-width: 0; }
.bx-tabs { max-width: 100%; }
.bx-list { grid-template-columns: minmax(0, 1fr); }
.bx-q, .bx-canvas-inner { min-width: 0; }

/* ---------- drag and drop grid ---------- */
.bx-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.bx-grid > .bx-q-editor, .bx-grid > .bx-empty { grid-column: 1 / -1; }
.bx-q-editor { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-lg); box-shadow: 0 0 0 3px var(--ring); }
.bx-q-editor .bx-q-edit { border-top: 0; }
@media (max-width: 760px) { .bx-grid > .bx-q { grid-column: 1 / -1 !important; } }
.bx-q.multi { border-color: var(--accent); background: var(--accent-soft); }
.bx-q.grabbed { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring), var(--shadow-lg); transform: scale(1.01); }
.bx-q.drop-left::before, .bx-q.drop-right::after { content: ""; position: absolute; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--accent); }
.bx-q.drop-left::before { left: -7px; } .bx-q.drop-right::after { right: -7px; }
.bx-grid.drop-end { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: var(--radius-lg); }
.bx-q[data-resize]::after { content: attr(data-resize); position: absolute; right: 12px; top: -12px; font-size: 11px; background: var(--text); color: var(--surface); padding: 2px 7px; border-radius: 99px; }
.bx-grip { border: 0; background: none; color: var(--muted); cursor: grab; display: grid; place-items: center; width: 26px; height: 32px; border-radius: 6px; flex: none; padding: 0; }
.bx-grip:hover, .bx-grip:focus-visible { background: var(--surface-2); color: var(--text); }
.bx-grip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.bx-resize { position: absolute; right: -2px; top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; border-radius: 4px; }
.bx-resize::before { content: ""; position: absolute; right: 2px; top: 50%; height: 22px; margin-top: -11px; width: 3px; border-radius: 3px; background: var(--border-strong); opacity: 0; transition: opacity .12s; }
.bx-q:hover .bx-resize::before, .bx-q.sel .bx-resize::before { opacity: 1; }
.bx-mv { display: none; gap: 2px; }
.bx-mv .btn.icon { width: 36px; height: 36px; }
@media (max-width: 760px) { .bx-mv { display: inline-flex; } .bx-resize { display: none; } .bx-q-row .tags { display: none; } }
.bx-bulk { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-lg); position: sticky; top: calc(var(--header-h) + 104px); z-index: 5; }
.bx-bulk select { height: 36px; }
@media (max-width: 760px) { .bx-bulk { position: static; gap: 6px; } .bx-bulk select { flex: 1 1 40%; } }

/* ---------- design editor, layout, code ---------- */
.bx-colors { display: flex; gap: 16px; flex-wrap: wrap; }
.bx-color { display: inline-flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.bx-code-input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; line-height: 1.5; min-height: 220px; white-space: pre; tab-size: 2; }
.CodeMirror { height: auto; min-height: 240px; border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 13px; }
.bx-html-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .bx-html-split { grid-template-columns: 1fr; } }
.bx-html .bx-pane, .bx-pane.bx-html { max-width: 1200px; }
.bx-html-editor .CodeMirror { min-height: 480px; }
.bx-html-preview { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.bx-found h4 { margin: 14px 0 6px; font-size: 13px; }
.bx-found-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; }
.bx-found-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bx-found-list code { font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.bx-flow { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0; }
.bx-flow li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 5px 10px; border-radius: 99px; }
.bx-flow-arrow { color: var(--muted); margin-left: 2px; }
.bx-doc-pages { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; }
.bx-doc-pages canvas { border: 1px solid var(--border); border-radius: 4px; box-shadow: var(--shadow); background: #fff; max-width: 100%; height: auto; }
.bx-langs { list-style: none; padding: 0; display: grid; gap: 6px; }
.bx-langs li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bx-ending, .bx-jump { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.bx-q-row .bx-mv button:focus-visible { outline: 2px solid var(--accent); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.rx-comments { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13.5px; }
.rx-comments p { margin: 2px 0 0; white-space: pre-wrap; }
.bx-q-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
.bx-q-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.bx-q.multi .lbl small, .bx-q.sel .lbl small { color: var(--text-2); }
/* images and media in the builder */
.bx-img-edit { display: grid; gap: 10px; margin-top: 8px; }
.bx-img-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bx-img-thumb { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.bx-img-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.bx-rich-wrap { border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius, 8px); background: var(--surface); overflow: hidden; }
.bx-rich-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.bx-rich { min-height: 110px; padding: 10px 12px; outline: none; line-height: 1.55; overflow-wrap: anywhere; }
.bx-rich:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.bx-rich h3 { font-size: 17px; margin: 8px 0 4px; } .bx-rich p { margin: 0 0 8px; } .bx-rich ul, .bx-rich ol { padding-left: 22px; margin: 0 0 8px; }
.bx-pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.bx-pic { border: 1px solid var(--border); border-radius: 10px; padding: 8px; display: grid; gap: 6px; background: var(--surface); }
.bx-pic img, .bx-pic-empty { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.bx-pic b { font-size: 13px; overflow-wrap: anywhere; }
.bx-pic-btns { display: flex; gap: 4px; align-items: center; }
.bx-pic-btns .btn { padding: 4px 8px; font-size: 13px; }
.rx-files { display: grid; gap: 8px; }
.rx-photo { display: inline-flex; flex-direction: column; gap: 4px; max-width: 220px; font-size: 13px; color: var(--muted); text-decoration: none; }
.rx-photo img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.rx-cell-photos { display: inline-flex; gap: 4px; }
.rx-cell-photos img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
/* response drawer on phones: nothing wider than the screen */
.rx-drawer .content { grid-template-columns: minmax(0, 1fr); }
.rx-drawer .content > * { min-width: 0; }
.rx-drawer .acts { flex-wrap: wrap; }
@media (max-width: 480px) { .rx-drawer header { flex-wrap: wrap; padding: 12px 14px; } .rx-drawer .content { padding: 14px; } }
