/* AI Query Labs — sample report (sample-audit.html). Builds on styles.css tokens. */

.rpt { padding: calc(var(--space-section) * 1.5) 0 calc(var(--space-section) * 3); display: flex; flex-direction: column; gap: calc(var(--space-section) * 1.5); }
main .rpt section { padding: 0; border-top: 0; }
main .rpt .rpt-cta { padding: calc(var(--space-section) * 1.25); }

/* ---------- Cover ---------- */
.rpt-cover {
  display: flex; flex-direction: column; gap: var(--space-section);
  padding: calc(var(--space-section) * 1.25); background: var(--card); border-radius: var(--radius-xl);
}
.rpt-cover-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rpt-cover-title { display: flex; flex-direction: column; gap: 10px; padding-bottom: var(--space-section); border-bottom: 1px solid var(--divider); }
.rpt-subject { font: 500 1.125rem/1.3 var(--font-sans); color: var(--muted-foreground); }
.rpt-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-gutter) var(--space-tab-gap); }
.rpt-meta div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rpt-meta dd { margin: 0; }
.rpt-note { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; background: var(--muted); border-radius: var(--radius-lg); color: var(--muted-foreground); }
.rpt-note .dot { transform: translateY(-1px); }

/* ---------- Body: TOC + sections ---------- */
.rpt-body { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: calc(var(--space-section) * 1.5); align-items: start; }
.rpt-toc { position: sticky; top: calc(var(--size-app-bar) + var(--space-gutter)); display: flex; flex-direction: column; gap: 12px; }
.rpt-toc ol { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--divider); }
.rpt-toc a {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 12px; margin-left: -1px;
  border-left: 1px solid transparent; color: var(--muted-foreground); text-decoration: none; font: 500 0.78125rem/1.125rem var(--font-sans);
}
.rpt-toc a:hover { color: var(--foreground); }
.rpt-toc a.is-active { color: var(--foreground); border-left-color: var(--foreground); }
.rpt-toc .n { font: 400 0.6875rem/1 var(--font-mono); color: var(--subtle-foreground); }
.rpt-toc-cta { align-self: flex-start; margin-top: 6px; }

.rpt-main { display: flex; flex-direction: column; gap: calc(var(--space-section) * 2); min-width: 0; }
.rpt-sec { display: flex; flex-direction: column; gap: var(--space-gutter); scroll-margin-top: calc(var(--size-app-bar) + 16px); }
.rpt-sec-head { display: flex; align-items: baseline; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--divider); }
.rpt-num { font: 500 0.8125rem/1 var(--font-mono); color: var(--subtle-foreground); font-variant-numeric: tabular-nums; }
.rpt-lede { color: var(--muted-foreground); max-width: var(--size-reply); }

/* ---------- 01 Executive summary ---------- */
.exec { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-section); align-items: stretch; }
.exec-score { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: var(--space-gutter); background: var(--card); border-radius: var(--radius-xl); }
.gauge { width: 152px; height: 152px; }
.gauge circle { fill: none; stroke-width: 9; }
.gauge-track { stroke: var(--secondary); }
.gauge-fill { stroke: var(--foreground); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; }
.gauge-num { font: 600 38px/1 var(--font-mono); letter-spacing: -0.04em; fill: var(--foreground); }
.gauge-of { font: 400 10px/1 var(--font-mono); fill: var(--subtle-foreground); }
.exec-band { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bands { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.bands-track {
  position: relative; height: 6px; border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--secondary) 0 39.6%, transparent 39.6% 40.4%, var(--secondary) 40.4% 59.6%, transparent 59.6% 60.4%, var(--accent) 60.4% 79.6%, transparent 79.6% 80.4%, var(--secondary) 80.4%);
}
.bands-marker { position: absolute; top: -4px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; background: var(--foreground); }
.bands-ticks { position: relative; height: 14px; list-style: none; padding: 0; color: var(--subtle-foreground); }
.bands-ticks li { position: absolute; top: 0; transform: translateX(-50%); }
.bands-ticks li:first-child { transform: none; }
.bands-ticks li:last-child { transform: translateX(-100%); }
.exec-copy { display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.exec-verdict { font: 600 1.25rem/1.25 var(--font-mono); letter-spacing: -0.02em; max-width: 30ch; }
.exec-copy > .text-muted { max-width: var(--size-reply); }
.takeaways { list-style: none; padding: 0; margin-top: 6px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.takeaways li { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--card); border-radius: var(--radius-lg); }
.takeaways li div { display: flex; flex-direction: column; gap: 4px; }
.tk-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--radius-full); background: var(--secondary); color: var(--foreground); }
.takeaways li.is-fail .tk-icon { color: var(--destructive); background: color-mix(in srgb, var(--destructive) 12%, transparent); }

/* ---------- Status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 7px; border-radius: var(--radius-full); font: 500 0.6875rem/1 var(--font-sans); white-space: nowrap; }
.chip .i { width: 12px; height: 12px; }
.chip-pass { background: var(--secondary); color: var(--foreground); }
.chip-partial { background: transparent; color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--input); }
.chip-fail { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }

/* ---------- 02 Score breakdown ---------- */
.sb { list-style: none; padding: 0; display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius-xl); }
.sb-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(80px, 1fr) 56px 82px; align-items: center; gap: var(--space-gutter); padding: 14px var(--space-gutter); border-top: 1px solid var(--border); }
.sb-row:first-child { border-top: 0; }
.sb-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sb-name a { text-decoration: none; }
.sb-name a:hover { text-decoration: underline; }
.sb-bar { height: 6px; border-radius: var(--radius-full); background: var(--secondary); overflow: hidden; }
.sb-bar span { display: block; height: 100%; border-radius: inherit; background: var(--foreground); }
.sb-row.is-partial .sb-bar span { background: var(--subtle-foreground); }
.sb-pts { text-align: right; }
.sb-pts span { color: var(--subtle-foreground); }
.sb-row.is-fail .sb-pts b { color: var(--destructive); }
.sb-chip { display: flex; justify-content: flex-end; }
.sb-total { display: flex; align-items: baseline; justify-content: flex-end; gap: 12px; padding: 0 var(--space-gutter); }
.sb-total .type-data { font-size: 1rem; }

/* ---------- 03 Findings ---------- */
.fd { display: flex; flex-direction: column; gap: var(--space-gutter); padding: var(--space-gutter); background: var(--card); border-radius: var(--radius-xl); scroll-margin-top: calc(var(--size-app-bar) + 16px); }
.fd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fd-head > div:first-child { display: flex; flex-direction: column; gap: 8px; }
.fd-score { display: flex; align-items: center; gap: 10px; }
.fd-score .type-data { color: var(--subtle-foreground); }
.fd-score b { color: var(--foreground); font-weight: 600; }
.fd-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0; border-radius: var(--radius-lg); background: var(--muted); }
.fd-grid div { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-left: 1px solid var(--border); }
.fd-grid div:first-child { border-left: 0; }
.fd-grid dd { margin: 0; color: var(--foreground); }
.bots { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.bots li { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted-foreground); }
.bots li .i { color: var(--foreground); }
.types { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.types li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 8px; border-radius: var(--radius-full); }
.types li.is-on { background: var(--secondary); }
.types li.is-off { box-shadow: inset 0 0 0 1px var(--input); color: var(--muted-foreground); }
.types li.is-off .type-helper { color: var(--subtle-foreground); }
table.pages td, table.pages th { padding-left: 0; }
table.pages td:last-child { white-space: nowrap; }

/* ---------- 04 Search ---------- */
.search-top { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 8px; }
.search-stat, .search-srcs { display: flex; flex-direction: column; gap: 10px; padding: var(--space-gutter); background: var(--card); border-radius: var(--radius-xl); }
.search-big { display: flex; align-items: baseline; gap: 8px; font: 600 3.5rem/0.95 var(--font-mono); letter-spacing: -0.04em; color: var(--destructive); }
.search-big .of { font: 400 1rem/1 var(--font-mono); letter-spacing: 0; color: var(--subtle-foreground); }
.miss { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--destructive); font-weight: 500; }
.src-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.src-list li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; align-items: center; gap: 12px; }
.src-list li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-list li > span:last-child { text-align: right; }
.src-bar { height: 6px; border-radius: var(--radius-full); background: var(--secondary); overflow: hidden; }
.src-bar span { display: block; height: 100%; background: var(--subtle-foreground); border-radius: inherit; }
.qtable { background: var(--card); border-radius: var(--radius-xl); }
.qtable th { padding-top: 12px; }
.qtable td { vertical-align: middle; }
.qtable th:first-child, .qtable td:first-child, .cmp th:first-child, .cmp td:first-child { padding-left: var(--space-gutter); }
.qtable th:last-child, .qtable td:last-child, .cmp th:last-child, .cmp td:last-child { padding-right: var(--space-gutter); }
.qtable td:nth-child(2) { min-width: 220px; }
.qtable td .miss { font: 500 0.75rem/1 var(--font-sans); }
.intent { display: inline-block; padding: 3px 8px; border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground); font: 500 0.6875rem/1 var(--font-sans); white-space: nowrap; }
.srcs { display: flex; flex-wrap: wrap; gap: 4px; min-width: 200px; }
td.srcs { display: table-cell; }
.src { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--muted); font: 400 0.6875rem/1rem var(--font-mono); color: var(--muted-foreground); white-space: nowrap; }
th.num, td.num { text-align: right; }

/* ---------- 05 Fix plan ---------- */
.fixes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fix { display: flex; flex-direction: column; gap: 8px; padding: var(--space-gutter); background: var(--card); border-radius: var(--radius-xl); }
.fix-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.prio { display: inline-grid; place-items: center; height: 22px; padding: 0 9px; border-radius: var(--radius-full); font: 600 0.6875rem/1 var(--font-mono); background: var(--secondary); color: var(--foreground); }
.prio-0 { background: var(--primary); color: var(--primary-foreground); }
.prio-2 { background: transparent; color: var(--muted-foreground); box-shadow: inset 0 0 0 1px var(--input); }
.fix-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.fix-tags span { padding: 3px 8px; border-radius: var(--radius-full); background: var(--muted); color: var(--muted-foreground); font: 500 0.6875rem/1 var(--font-sans); white-space: nowrap; }
.plans-cmp { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.cmp { background: var(--card); border-radius: var(--radius-xl); }
.cmp th { padding-top: 14px; vertical-align: bottom; }
.cmp th, .cmp td { text-align: center; }
.cmp th:first-child, .cmp td:first-child { text-align: left; }
.cmp td .i { display: inline-block; width: 16px; height: 16px; }
.cmp-price { display: block; margin-top: 6px; font: 600 0.875rem/1 var(--font-mono); letter-spacing: -0.01em; text-transform: none; color: var(--foreground); }
.cmp-no { color: var(--subtle-foreground); }

/* ---------- 06 Methodology ---------- */
.steps-m { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.steps-m li { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--card); border-radius: var(--radius-lg); }
.read { display: flex; flex-direction: column; gap: 10px; }
.read-bands { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.read-bands li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--border); color: var(--muted-foreground); }
.read-bands li.is-on { background: var(--secondary); box-shadow: none; color: var(--foreground); font-weight: 500; }
.rpt-caveat { display: flex; align-items: baseline; gap: 8px; color: var(--muted-foreground); max-width: 72ch; }
.rpt-caveat .dot { transform: translateY(-1px); }

/* ---------- CTA ---------- */
.rpt-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: calc(var(--space-section) * 1.25); background: var(--sidebar); border-radius: var(--radius-xl); }
.rpt-cta .btn-row { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .rpt-body { grid-template-columns: 1fr; }
  .rpt-toc { position: static; padding: 14px var(--space-panel); background: var(--card); border-radius: var(--radius-xl); }
  .rpt-toc ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-left: 0; gap: 0 12px; }
  .rpt-toc a { padding: 6px 0; margin: 0; border-left: 0; }
  .rpt-toc .rpt-toc-cta { display: none; }
  .rpt-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .rpt { padding-top: var(--space-gutter); gap: var(--space-section); }
  .rpt-cover { padding: var(--space-gutter); gap: var(--space-gutter); }
  .rpt-cover .type-display { font-size: 2.125rem; }
  .rpt-subject { font-size: 1rem; }
  .rpt-toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rpt-main { gap: calc(var(--space-section) * 1.5); }
  .exec, .search-top { grid-template-columns: 1fr; }
  .takeaways, .fixes, .fd-grid { grid-template-columns: 1fr; }
  .fd-grid div { border-left: 0; border-top: 1px solid var(--border); }
  .fd-grid div:first-child { border-top: 0; }
  .fd { padding: var(--space-panel); }
  .fd-head { flex-direction: column; gap: 10px; }
  .sb-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name chip" "bar pts"; gap: 10px 14px; padding: 14px var(--space-panel); }
  .sb-name { grid-area: name; } .sb-chip { grid-area: chip; align-self: start; } .sb-bar { grid-area: bar; } .sb-pts { grid-area: pts; }
  .sb-total { padding: 0 var(--space-panel); }
  .src-list li { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 36px; gap: 10px; }
  .steps-m, .read-bands { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main .rpt .rpt-cta { padding: var(--space-gutter); }
  /* Search table becomes stacked rows */
  .qtable, .qtable tbody, .qtable tr, .qtable td { display: block; }
  .qtable thead { display: none; }
  .qtable tr { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 12px var(--space-panel); border-top: 1px solid var(--border); }
  .qtable tr:first-child { border-top: 0; }
  .qtable td, .qtable td:first-child, .qtable td:last-child { padding: 0; border: 0; min-width: 0; }
  .qtable td:nth-child(1) { grid-column: 1; grid-row: 1; text-align: left; align-self: start; padding-top: 1px; }
  .qtable td:nth-child(2) { grid-column: 2 / 4; grid-row: 1; font-weight: 500; }
  .qtable td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .qtable td:nth-child(4) { grid-column: 3; grid-row: 2; }
  .qtable td.srcs { grid-column: 2 / 4; grid-row: 3; display: block; min-width: 0; }
  /* Plan comparison fits 390px */
  .cmp { table-layout: fixed; }
  .cmp th:first-child, .cmp td:first-child { width: 38%; padding-left: 12px; }
  .cmp th, .cmp td { padding-left: 4px; padding-right: 4px; white-space: normal; }
  .cmp th:last-child, .cmp td:last-child { padding-right: 8px; }
  .cmp th { font-size: 0.5625rem; letter-spacing: 0.04em; }
  .cmp-price { font-size: 0.75rem; }
  .rpt-cta .btn-row { flex-direction: column; align-items: stretch; width: 100%; }
}

/* ---------- Print ---------- */
@media print {
  :root { color-scheme: light; --background: #fff; --card: #fff; --muted: #f3f3f3; --secondary: #e6e6e6; --accent: #d6d6d6; --sidebar: #f3f3f3;
    --foreground: #0a0a0a; --muted-foreground: #474747; --subtle-foreground: #686868; --primary: #141414; --primary-foreground: #fff;
    --border: #0000001f; --divider: #cdcdcd; --input: #909090; --destructive: #b91c1c; --warning: #a16207; }
  @page { margin: 14mm; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-header, .site-footer, .skip, .rpt-toc, .rpt-cta { display: none !important; }
  .wrap { width: 100%; }
  .rpt { padding: 0; }
  .rpt-body { display: block; }
  .rpt-cover, .fd, .sb, .exec-score, .takeaways li, .fix, .search-stat, .search-srcs, .qtable, .cmp, .steps-m li { box-shadow: inset 0 0 0 1px #0000001f; }
  .rpt-sec { break-before: auto; margin-top: 18px; }
  .fd, .fix, .sb-row, .exec, .search-top, tr, .rpt-cta, .steps-m li { break-inside: avoid; }
  .rpt-sec-head { break-after: avoid; }
  a { text-decoration: none; }
}
