/* Theme Audits pillar */
.qfl-sub { color: #666; font-size: 13px; margin: 4px 0 16px; max-width: 720px; }
.qfl-run { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.qfl-qs { font-size: 12px; color: #888; margin-left: auto; white-space: nowrap; }
.qfl-score { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.qfl-counts { font-size: 12px; color: #555; white-space: nowrap; font-variant-numeric: tabular-nums; }
.qfl-link { color: #2563eb; text-decoration: none; cursor: pointer; }
.qfl-link:hover { text-decoration: underline; }
/* Output action icon-buttons (Scan / Action plan / Figma / Competitors / Rescan / Grades) */
.qfl-outputs { line-height: 1; }
.qfl-outbtn {
  display: inline-flex; align-items: center; gap: 5px; margin: 2px 5px 2px 0;
  padding: 3px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); color: var(--fg); font: inherit; font-size: 12px;
  cursor: pointer; white-space: nowrap; vertical-align: middle;
}
.qfl-outbtn:hover { background: var(--hover); border-color: var(--muted); }
.qfl-outbtn:disabled { opacity: .5; cursor: default; }
.qfl-outbtn svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.qfl-outbtn:hover svg { color: var(--accent); }
.qfl-comp-heading { margin: 32px 0 2px; font-size: 16px; }

.qfl-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.qfl-badge.ok   { background: #dcfce7; color: #15803d; }
.qfl-badge.warn { background: #fef3c7; color: #b45309; }
.qfl-badge.bad  { background: #fee2e2; color: #b91c1c; }
.qfl-qs-manage { font-size: 12px; color: #888; margin: -6px 0 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qfl-hint { color: #999; font-size: 12px; font-style: italic; }
.qfl-uploadbar { display: flex; align-items: center; gap: 10px; margin: -8px 0 18px; }
.qfl-uploadbar__track { flex: 0 1 320px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.qfl-uploadbar__fill { height: 100%; width: 0; background: #008c82; border-radius: 3px; transition: width 0.15s ease; }
.qfl-uploadbar[hidden] { display: none; }
/* Per-install merchant-report mode (3-way segmented toggle) */
.qfl-visgroup { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.qfl-vis { font: inherit; font-size: 11px; font-weight: 600; padding: 3px 9px; border: 0; border-right: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer; white-space: nowrap; }
.qfl-vis:last-child { border-right: 0; }
.qfl-vis.is-on { background: #2563eb; color: #fff; font-weight: 700; }
.qfl-vis:hover:not(.is-on):not(:disabled) { background: var(--hover); }
.qfl-vis:disabled { cursor: default; }

/* Per-store accordion: latest scan is the header, older ones collapse under it */
.qfl-collapsed { display: none; }
.qfl-groupbtn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; text-align: left; }
.qfl-chev { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 44px; font-size: 22px; line-height: 1; color: var(--muted); transition: transform 0.12s ease; }
.qfl-groupbtn:hover .qfl-chev { color: var(--fg); }
.qfl-groupbtn.is-open .qfl-chev { transform: rotate(90deg); }
.qfl-shopname { font-weight: 600; }
.qfl-groupcount { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--code-bg); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.qfl-groupbtn:hover .qfl-shopname { text-decoration: underline; }
.qfl-childrow { background: var(--surface-2); }
.qfl-childrow td { color: var(--muted); }
.qfl-childstore { text-align: center; }
.qfl-childtick { font-size: 18px; color: #cbd5e1; }

/* Rendered-markdown slide-out (Scan / Action plan) — half width, full on mobile */
.qfl-drawer--wide { width: 50%; max-width: none; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
@media (max-width: 768px) { .qfl-drawer--wide { width: 100%; } }
.qfl-md__loading { padding: 28px; color: var(--muted); }
.qfl-md__head { background: var(--card); border-bottom: 1px solid var(--border); padding: 18px 56px 18px 28px; display: flex; align-items: baseline; gap: 16px; flex: none; }
.qfl-md__head h2 { margin: 0; font-size: 18px; flex: 1; min-width: 0; }
.qfl-drawer--wide .qfl-drawer__close { top: 16px; right: 20px; z-index: 2; }
.qfl-md { flex: 1; padding: 8px 28px 40px; overflow-y: auto; }
.qfl-md__intro { color: var(--fg); font-size: 14px; margin: 14px 0 8px; }

/* Accordion sections */
.qfl-md__section { border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; overflow: hidden; }
.qfl-md__summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 14px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; user-select: none; }
.qfl-md__summary::-webkit-details-marker { display: none; }
.qfl-md__summary::before { content: "▸"; color: var(--muted); font-size: 16px; transition: transform 0.12s ease; }
.qfl-md__section[open] > .qfl-md__summary::before { transform: rotate(90deg); }
.qfl-md__section[open] > .qfl-md__summary { border-bottom: 1px solid var(--border); }
.qfl-md__summary:hover { background: var(--hover); }
.qfl-md__body { padding: 4px 18px 16px; }

/* Markdown typography */
.qfl-md__body h3, .qfl-md .qfl-md__h3 { font-size: 14px; margin: 16px 0 6px; }
.qfl-md__body h4, .qfl-md .qfl-md__h4 { font-size: 13px; margin: 14px 0 6px; color: var(--fg); }
.qfl-md p { margin: 8px 0; line-height: 1.55; font-size: 13px; color: var(--fg); }
.qfl-md__list { margin: 8px 0; padding-left: 22px; }
.qfl-md__list li { margin: 4px 0; line-height: 1.5; font-size: 13px; color: var(--fg); }
.qfl-md code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qfl-md__pre { background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.qfl-md__pre code { background: none; color: inherit; padding: 0; }
.qfl-md__quote { border-left: 3px solid #cbd5e1; margin: 10px 0; padding: 2px 14px; color: var(--muted); font-size: 13px; }
.qfl-md hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.qfl-md__tablewrap { overflow-x: auto; margin: 10px 0; }
.qfl-md__table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.qfl-md__table th, .qfl-md__table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.qfl-md__table th { background: var(--surface-2); font-weight: 600; }

/* Screenshot thumbnails in the drawer */
.qfl-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.qfl-shot { margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); transition: box-shadow 0.12s ease; }
.qfl-shot:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.qfl-shot img { display: block; width: 100%; height: 150px; object-fit: cover; object-position: top; background: var(--surface-2); }
.qfl-shot img:not([src]) { min-height: 150px; }
.qfl-shot figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600; color: var(--fg); }
.qfl-shot__n { font-weight: 500; color: #94a3b8; font-size: 11px; white-space: nowrap; }

/* Sensible column widths for the Theme Audits table */
#ta-table td, #ta-table th { vertical-align: middle; }
#ta-table th:nth-child(2), #ta-table td:nth-child(2) { white-space: nowrap; width: 1%; }   /* Date */
#ta-table th:nth-child(3), #ta-table td:nth-child(3) { width: 64px; text-align: center; }   /* Score */
#ta-table th:nth-child(4), #ta-table td:nth-child(4) { width: 120px; }                       /* Risk */
#ta-table th:nth-child(5), #ta-table td:nth-child(5) { white-space: nowrap; width: 1%; }    /* N/O/C/QW */
#ta-table th:nth-child(6), #ta-table td:nth-child(6) { width: 120px; }                       /* Status */
#ta-table th:nth-child(7), #ta-table td:nth-child(7) { white-space: nowrap; width: 1%; }    /* Outputs */
#ta-table th:nth-child(8), #ta-table td:nth-child(8) { width: 300px; }                       /* Merchant */

/* Raw figma.json drawer + copy button */
.qfl-json__actions { display: flex; align-items: center; gap: 14px; flex: none; }
.qfl-json__copy.is-done { background: #16a34a; border-color: #16a34a; color: #fff; }
.qfl-json { flex: 1; margin: 0; padding: 16px 20px; overflow: auto; white-space: pre; tab-size: 2;
  background: #0f172a; color: #e2e8f0; font-size: 12px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.qfl-json code { background: none; color: inherit; padding: 0; }

/* Standardised Figma copy editor */
.qfl-copyform { display: flex; flex-direction: column; gap: 18px; }
.qfl-copyset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px 16px; margin: 0; }
.qfl-copyset legend { font-weight: 700; font-size: 13px; padding: 0 6px; color: var(--fg); }
.qfl-copyfield { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.qfl-copyfield > span { font-size: 12px; color: var(--muted); }
.qfl-copyfield input, .qfl-copyfield textarea { font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--fg); width: 100%; box-sizing: border-box; }
.qfl-copyfield textarea { resize: vertical; line-height: 1.45; }
.qfl-copyfield input:focus, .qfl-copyfield textarea:focus { outline: none; border-color: #2563eb; }

/* Competitor picker drawer */
.qfl-comp-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; cursor: pointer; }
.qfl-comp-row:hover { background: var(--surface-2); }
.qfl-comp-row input { width: 17px; height: 17px; }
.qfl-comp-dom { font-weight: 600; font-size: 14px; }
