/* Same font file as the main app (see fonts/README.txt), so the shared header
   and tool tabs render pixel-identically on every tool page. */
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/geist-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: light;
  --canvas: #eaf2ff;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #24372f;
  --muted: #687b71;
  --quiet: #6f83a3;
  --line: #d8e4f3;
  --blue: #285fe8;
  --blue-hover: #174bd1;
  --blue-soft: #edf3ff;
  --green: #4c9673;
  --ok: #28734e;
  --err: #b3402f;
  --bar-bg: rgb(255 255 255 / 82%);
  --bar-border: rgb(219 228 243 / 90%);
  --bar-shadow: 0 8px 28px rgb(23 32 51 / 8%);
  --input-border: #c9d9ed;
  --placeholder: #8a98ab;
  --choice-border: #b7cbff;
  --choice-ink: #2447a8;
  --ok-soft: #eef6f1;
  --ok-line: #bcd9c7;
  --err-soft: #fbeeeb;
  --err-line: #e6c3bc;
  --grid-line: rgba(64, 112, 184, .055);
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0b1220;
  --surface: #111a2e;
  --surface-soft: #16213a;
  --ink: #e6ecf8;
  --muted: #9aa8bf;
  --quiet: #8da2c2;
  --line: #26324a;
  --blue: #8aa9ff;
  --blue-hover: #a9c0ff;
  --blue-soft: #1a2a4d;
  --green: #5aaf7c;
  --ok: #7fd1a1;
  --err: #f0a597;
  --bar-bg: rgb(17 26 46 / 85%);
  --bar-border: #26324a;
  --bar-shadow: 0 8px 28px rgb(0 0 0 / 35%);
  --input-border: #34456a;
  --placeholder: #6f7f99;
  --choice-border: #34507f;
  --choice-ink: #dbe5ff;
  --ok-soft: #10261b;
  --ok-line: #24533a;
  --err-soft: #2a1512;
  --err-line: #5c2d25;
  --grid-line: rgba(120, 150, 210, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  padding: 10px 18px 36px;
  color: var(--ink);
  background-color: var(--canvas);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 25px 25px;
  font: 15px/1.45 var(--mono);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
h1, h2, h3, p { margin: 0; }
.window { max-width: 1480px; margin: 0 auto; }
.topbar {
  position: sticky;
  top: 6px;
  z-index: 40;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
  padding: 6px 12px;
  border: 1px solid var(--bar-border);
  border-radius: 10px;
  background: var(--bar-bg);
  box-shadow: var(--bar-shadow);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; color: inherit; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35);
  font-size: 11px; font-weight: 800;
}
.brand-copy { display: grid; gap: 1px; min-width: 0; }
.brand-copy strong { font-size: 16px; font-weight: 700; line-height: 1.2; }
.brand-copy > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ready-indicator { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.ready-indicator i { width: 8px; height: 8px; border: 2px solid var(--line); border-radius: 50%; background: var(--muted); }
.ready-indicator.is-ready i { border-color: var(--ok-line); background: var(--green); }
.theme-toggle { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.theme-toggle button { min-height: 24px; border: 1px solid transparent; border-radius: 5px; padding: 0 10px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 650; }
.theme-toggle button[aria-pressed="true"] { border-color: var(--line); background: var(--surface); color: var(--blue); box-shadow: 0 1px 3px rgba(20, 45, 90, .12); }
.topbar-run {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 16px rgba(37, 99, 235, .3);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.topbar-run:hover:not(:disabled) { filter: brightness(1.08); }
.topbar-run:disabled { opacity: .65; cursor: not-allowed; }
/* Tool tabs: tabs fill the bar so the active underline sits on its bottom edge,
   and the first tab's text lines up with the logo in the top bar. */
.module-nav {
  min-height: 44px;
  position: sticky;
  top: 58px;
  z-index: 35;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 16px;
  margin: 0 0 24px;
  padding: 0 12px 0 0;
  border: 1px solid var(--bar-border);
  border-radius: 10px;
  background: var(--bar-bg);
  box-shadow: var(--bar-shadow);
  backdrop-filter: blur(12px);
}
.tool-links { display: flex; flex-wrap: wrap; gap: 4px; }
.module-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s ease, border-color .15s ease;
}
.module-nav a:hover { color: var(--ink); }
.module-nav a[aria-current="page"] { border-bottom-color: var(--blue); color: var(--blue); }
.module-nav a:focus-visible { outline: 2px solid var(--blue); outline-offset: -4px; border-radius: 6px; }
.page-heading { padding: 0 2px 16px; }
.eyebrow { margin-bottom: 6px; color: var(--blue); font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: .02em; }
.page-heading h1 { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
.page-subheading { max-width: 72ch; margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 18px rgba(33, 62, 110, .06); }
.capture-form { display: grid; }
.form-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); padding: 16px; }
.form-section { min-width: 0; }
.source-section { padding-right: 20px; }
.settings-section { padding-left: 20px; border-left: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step-number { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; border-radius: 7px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; font-size: 10px; font-weight: 800; }
.section-heading h2 { font-size: 15px; font-weight: 750; line-height: 1.2; }
.section-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.input-mode-options, .device-options { min-width: 0; margin: 0; padding: 0; border: 0; }
.input-mode-options { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.input-mode-options legend, .device-options legend { width: 100%; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.input-mode-options label { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer; }
.input-mode-options label:has(input:checked) { border-color: var(--choice-border); background: var(--blue-soft); color: var(--choice-ink); }
.input-mode-options input { accent-color: var(--blue); }
.field-label { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; color: var(--ink); font-size: 13px; font-weight: 700; }
.section-heading + .field-label { margin-top: 0; }
.optional, .field-count { color: var(--muted); font-size: 12px; font-weight: 500; }
.field-count.over-limit { color: var(--err); font-weight: 700; }
textarea, input[type="text"] { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--input-border); border-radius: 6px; outline: 0; background: var(--surface); color: var(--ink); }
textarea { min-height: 132px; resize: vertical; line-height: 1.55; }
textarea::placeholder, input[type="text"]::placeholder { color: var(--placeholder); }
textarea:focus, input[type="text"]:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(40, 95, 232, .12); }
.device-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.device-options legend { grid-column: 1 / -1; }
.device-options .mobile-width { justify-content: space-between; border-style: dashed; background: transparent; color: var(--muted); font-size: 13px; cursor: default; }
.device-options .mobile-width:has(select:disabled) { opacity: .55; }
.device-options select { padding: 4px 6px; border: 1px solid var(--input-border); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12px; }
.choice-meta { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.device-options label { display: flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
.device-options label:has(input:checked) { border-color: var(--choice-border); background: var(--blue-soft); color: var(--choice-ink); }
.device-options input, .popup-option input { width: 15px; height: 15px; flex: 0 0 15px; margin: 0; accent-color: var(--blue); }
.popup-option { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }
.popup-option:has(input:checked) { border-color: var(--choice-border); background: var(--blue-soft); }
.popup-option input { margin-top: 2px; }
.popup-option strong { display: block; font-size: 14px; font-weight: 700; }
.choice-help { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.retention-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.form-footer { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.form-actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 36px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 700; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-soft); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; box-shadow: 0 5px 12px rgba(40, 95, 232, .2); }
.btn.primary:hover { background: linear-gradient(135deg, #3b82f6, #1d4ed8); filter: brightness(1.08); }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }
.progress { margin-top: 16px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.progress[hidden] { display: none; }
.bar { height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-soft); }
.fill { width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }
.fill.error { background: var(--err); }
.meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 10px; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.stages li { padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); color: var(--muted); font-size: 9px; }
.stages li.done { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.stages li.active { border-color: var(--choice-border); background: var(--blue-soft); color: var(--blue); }
.activity { margin: 10px 0 0; padding: 8px 10px; max-height: 96px; overflow-y: auto; list-style: none; border-radius: 6px; background: var(--surface-soft); font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.activity li { display: flex; gap: 8px; }
.activity li::before { content: '\2713'; color: var(--ok); }
.activity li:last-child { color: var(--blue); }
.activity li:last-child::before { content: '\25CF'; color: var(--blue); animation: pulse 1s ease-in-out infinite; }
.activity time { opacity: .6; }
@keyframes pulse { 50% { opacity: .25; } }
.link-list { margin: 8px 0 0; padding: 6px 10px 6px 30px; max-height: 110px; overflow-y: auto; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.link-list[hidden] { display: none; }
.notice { margin-top: 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.notice.success { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }
.notice.error { border-color: var(--err-line); background: var(--err-soft); color: var(--err); }
.results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.results-toolbar { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.capture-result { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.capture-result h2 { margin: 0 0 8px; color: var(--ink); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.capture-result.failed { border-color: var(--err-line); }
.capture-result.failed h2 { color: var(--err); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.folder { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.preview { width: 100%; aspect-ratio: 5 / 3; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
[hidden] { display: none !important; }
.visitor-count { margin: 20px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.visitor-count span { margin-right: 4px; color: #22a06b; font-size: 8px; vertical-align: 1px; }
@media (max-width: 1000px) { .results { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  body { padding: 10px 18px 36px; }
  .form-grid { grid-template-columns: 1fr; gap: 18px; }
  .source-section { padding-right: 0; }
  .settings-section { padding: 16px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 520px) {
  .results { grid-template-columns: 1fr; }
  body { padding: 10px 12px 24px; }
  .topbar { align-items: center; }
  .brand-copy > span { max-width: 190px; white-space: normal; overflow: visible; text-overflow: clip; }
  .toolbar-actions { gap: 5px; }
  .module-nav { position: static; }
  .module-nav a { padding: 0 10px; }
  .form-grid { padding: 13px; }
  .form-footer { align-items: flex-start; flex-direction: column; padding: 12px 13px; }
  .form-actions { width: 100%; }
  .form-actions .btn { flex: 1; white-space: normal; }
  .device-options { grid-template-columns: 1fr; }
  .device-options legend { grid-column: auto; }
  .actions .btn { flex: 1; }
}

/* Shared chrome: identical to the main app (copy-qa-tool/app/globals.css and
   theme-dark.css) so switching tools never shifts a pixel. Values are read from
   the main app; change both together. */
body {
  background-color: #edf2fb;
  background-image:
    radial-gradient(900px 420px at 12% -90px, rgb(79 109 245 / 14%), transparent 70%),
    radial-gradient(700px 380px at 95% 0px, rgb(34 197 220 / 10%), transparent 70%),
    linear-gradient(rgb(36 87 214 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(36 87 214 / 4%) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
}
.brand-mark { font-weight: 700; line-height: 1.5; }
.brand-copy { gap: 0; }
.brand-copy strong { color: #172033; }
.brand-copy > span { color: #64748b; line-height: 16.5px; }
.module-nav { box-shadow: 0 6px 20px rgb(23 32 51 / 6%); }
.module-nav a { color: #64748b; }
.module-nav a:hover { color: #172033; }
.module-nav a[aria-current="page"] { color: #1d4ed8; border-bottom-color: #2563eb; }
.eyebrow { color: #4f6df5; }
.page-heading h1 { color: #1c3328; }
.page-subheading, .retention-note { color: #64748b; }
.theme-toggle { height: 30px; gap: 2px; padding: 2px; border-color: #dbe4f3; border-radius: 7px; background: #eaf0fb; }
.theme-toggle button { height: 24px; color: #64748b; font-size: 15px; font-weight: 600; line-height: 22px; }
.theme-toggle button[aria-pressed="true"] { border-color: #cbd9f5; color: #1d4ed8; background: #fff; box-shadow: none; }

:root[data-theme="dark"] body {
  background-color: #0b1220;
  background-image:
    radial-gradient(900px 420px at 12% -90px, rgb(10 41 178 / 14%), transparent 70%),
    radial-gradient(700px 380px at 95% 0px, rgb(33 191 212 / 10%), transparent 70%),
    linear-gradient(rgb(36 87 214 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(36 87 214 / 4%) 1px, transparent 1px);
}
:root[data-theme="dark"] .brand-copy strong { color: #e6ecf8; }
:root[data-theme="dark"] .brand-copy > span,
:root[data-theme="dark"] .module-nav a,
:root[data-theme="dark"] .retention-note,
:root[data-theme="dark"] .theme-toggle button { color: #93a1ba; }
:root[data-theme="dark"] .page-subheading { color: #9aa8bf; }
:root[data-theme="dark"] .module-nav a:hover { color: #e6ecf8; }
:root[data-theme="dark"] .theme-toggle { border-color: #26324a; background: #0d1526; }
:root[data-theme="dark"] .theme-toggle button[aria-pressed="true"] { border-color: #34456a; color: #8aa9ff; background: #16213a; }

:root[data-theme="dark"] .module-nav { box-shadow: 0 8px 28px rgb(0 0 0 / 35%); }
:root[data-theme="dark"] .module-nav a[aria-current="page"] { color: #8aa9ff; border-bottom-color: #8aa9ff; }
:root[data-theme="dark"] .eyebrow { color: #8aa9ff; }
:root[data-theme="dark"] .page-heading h1 { color: #e6ecf8; }

/* A- / A+ text size: same control and values as the main app; it scales the
   tool below the page title, the header and tabs stay fixed. */
.workspace, .notice, .results { zoom: var(--font-scale, 1); }
.app-font-controls {
  display: inline-flex; min-height: 32px; align-items: center; gap: 5px; padding: 2px 5px;
  border: 1px solid #d5dfd6; border-radius: 5px; color: #516258; background: rgb(255 255 255 / 85%);
  font-family: var(--mono); font-size: 10px; line-height: 15px;
}
.app-font-controls button {
  min-width: 27px; height: 26px; padding: 0; border: 0; border-radius: 4px; color: #1b3f9e; background: transparent;
  font-family: var(--mono); font-size: 14px; font-weight: 700; line-height: 21px; cursor: pointer;
}
.app-font-controls button:hover:not(:disabled) { background: #edf4ed; }
.app-font-controls button:disabled { opacity: 0.4; cursor: not-allowed; }
:root[data-theme="dark"] .app-font-controls { border-color: #26324a; color: #9aa8bf; background: #0d1526; }
:root[data-theme="dark"] .app-font-controls button { color: #8aa9ff; }
:root[data-theme="dark"] .app-font-controls button:hover:not(:disabled) { background: #16213a; }
/* Text size and theme at the far right, as on the other tools. */
.toolbar-actions > .app-font-controls { order: 1; }
.toolbar-actions > .theme-toggle { order: 2; }

