/* =============================================================================
   ASO Report — light UI in the Tasker house style.

   Layering, taken from Tasker: a white page, a light grey-blue "shelf" for each
   card, white controls on top of it. Depth comes from that stack plus hairline
   borders — not from shadows, which are reserved for things that actually float
   (the app-picker panel).

   One accent only. Indigo marks the primary action and the current selection;
   everything else is greyscale so those two readings stay unambiguous.
   ============================================================================= */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #ffffff;
  --surface: #f8f9fb;        /* card shelf */
  --surface-2: #ffffff;      /* controls on the shelf */
  --surface-3: #f1f3f7;      /* hover / inset wells */

  /* Lines */
  --border: #e8eaef;
  --border-strong: #d9dde5;

  /* Ink */
  --text: #12141a;
  --text-2: #4b5563;
  --muted: #8b93a1;

  /* Accent — the one colour that means "chosen" or "go" */
  --accent: #5b57e0;
  --accent-hover: #4a46cf;
  --accent-soft: #eeedfc;

  /* Status */
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --warn: #b45309;
  --warn-soft: #fdf2e3;
  --err: #dc2626;
  --err-soft: #fdeaea;

  --shadow-pop: 0 12px 32px rgba(18, 20, 26, .14), 0 2px 6px rgba(18, 20, 26, .06);
  --radius-card: 16px;
  --radius-ctl: 10px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
          Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* `hidden` is a UA-stylesheet rule, so any class that sets `display` beats it.
   Several components here do (the picker panel is flex) — pin it once. */
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0 0 72px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* =============================================================================
   Top bar — brand, then the app picker. Nothing else lives here.
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}

.topbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex: 0 0 1px;
}

/* ---- The picker ---------------------------------------------------------- */

.picker { position: relative; min-width: 0; }

.picker-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px 5px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-ctl);
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  max-width: 380px;
  transition: background .12s ease, border-color .12s ease;
}
.picker-trigger:hover { background: var(--surface-3); }
.picker-trigger[aria-expanded="true"] {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.picker-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
}
.picker-avatar.is-empty { border: 1px dashed var(--border-strong); background: transparent; }

.picker-labels {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
  min-width: 0;
}
.picker-eyebrow { font-size: 11px; color: var(--muted); }
.picker-value {
  font-size: 14px;
  font-weight: 600;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-trigger.is-empty .picker-value { color: var(--muted); font-weight: 500; }

.picker-chevron { color: var(--muted); flex: 0 0 12px; }

/* ---- The panel ----------------------------------------------------------- */

.picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 420px;
  max-width: calc(100vw - 32px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.picker-search { padding: 10px; border-bottom: 1px solid var(--border); }
.picker-search input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.picker-search input:focus { outline: none; border-color: var(--accent); background: var(--bg); }

.picker-list { max-height: 380px; overflow-y: auto; padding: 6px; }

.picker-group + .picker-group { margin-top: 6px; }
.picker-group-head {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-weight: 400;
  color: var(--text);
}
.picker-row:hover { background: var(--surface-3); }
.picker-row.is-selected { background: var(--accent-soft); }

.picker-row-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.picker-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.picker-row-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-row-sub { font-size: 11.5px; color: var(--muted); }
.picker-row-sub code { font-family: var(--mono); font-size: 11.5px; }

.picker-row-check { color: var(--accent); font-size: 13px; opacity: 0; flex: 0 0 auto; }
.picker-row.is-selected .picker-row-check { opacity: 1; }

.picker-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
}
.picker-stale { color: var(--warn); }

/* =============================================================================
   Layout
   ========================================================================== */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; }
.card-head-note { margin: 6px 0 16px; }

/* =============================================================================
   Forms
   ========================================================================== */

label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
label > span { display: block; margin-bottom: 6px; color: var(--text); }

input[type="text"], input[type="search"], input:not([type]),
input[type="number"], textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-ctl);
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #b3b9c4; }

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, textarea:disabled { background: var(--surface-3); cursor: not-allowed; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
}
.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: 0 0 16px;
  cursor: pointer;
}
.checks { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-top: 10px; }

.hint { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; line-height: 1.5; }
.hint.is-error { color: var(--err); }

fieldset, .countries-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 16px;
  margin: 0 0 16px;
}
legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
}

details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  padding: 14px 16px;
  margin-bottom: 16px;
}
details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform .15s ease;
}
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { margin-bottom: 14px; }

/* =============================================================================
   Buttons
   ========================================================================== */

button {
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-ctl);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }

button.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
button.btn-secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--muted); }

button.btn-sm { padding: 6px 14px; font-size: 13px; }

button.mini-btn {
  padding: 3px 9px;
  font-size: 11.5px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border-strong);
}
button.mini-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
button.mini-btn.copied { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

button.link-btn {
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 550;
}
button.link-btn:hover { background: none; text-decoration: underline; }

#submit-btn { width: 100%; padding: 12px; font-size: 14.5px; margin-top: 4px; }

/* =============================================================================
   Pills, chips, badges
   ========================================================================== */

.pill-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }

.pill {
  padding: 6px 15px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pill:hover:not(.is-active) { background: var(--surface-3); color: var(--text); }
.pill.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 550;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.muted { background: var(--surface-3); color: var(--muted); }

/* =============================================================================
   Status, results, code
   ========================================================================== */

#status {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
#status code { color: var(--text); }

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
}
pre.err { background: var(--err-soft); border-color: #f6cfcf; color: #8c1d1d; }

code { font-family: var(--mono); font-size: .92em; }

.copy-block { position: relative; }
.copy-block button { position: absolute; top: 8px; right: 8px; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
table th, table td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table th {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-3);
}

/* Stage timing breakdown — label left, duration right. */
.timing-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 12.5px;
}
.timing-row span { color: var(--text); }
.timing-row b { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timing-list + h5 { margin-top: 12px; }

#result h3 { margin: 18px 0 8px; font-size: 15px; font-weight: 650; }
#result h4 { margin: 14px 0 6px; font-size: 13.5px; font-weight: 600; }
details > h5 { margin: 12px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted); }

/* =============================================================================
   Locale picker
   ========================================================================== */

.countries-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.countries-toolbar button { padding: 6px 13px; font-size: 12.5px; }
.countries-toolbar .hint { margin-left: auto; }

.countries-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 300px;
  overflow-y: auto;
  padding: 2px;
}

.country-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 6px 12px !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 999px !important;
  background: var(--surface-2) !important;
  color: var(--text) !important;
  cursor: pointer;
  font-size: 13px;
  margin: 0 !important;
}
.country-chip:hover { background: var(--surface-3) !important; }
.country-chip:has(input:checked) {
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
}
.country-chip span { display: inline; margin: 0; }
.country-chip code { color: var(--muted); font-size: 11px; }

/* =============================================================================
   Result view — country tabs
   ========================================================================== */

.country-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.country-tab {
  padding: 6px 15px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.country-tab:hover:not(.active) { background: var(--surface-3); color: var(--text); }
.country-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.country-tab .badge { font-size: 10px; margin-left: 5px; }
.country-tab.active .badge { background: rgba(255,255,255,.22); color: #fff; }

/* =============================================================================
   Meta table — TITLE / SUBTITLE / DESCRIPTION / KEYWORDS
   ========================================================================== */

.meta-table {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
/* The row LABEL is a <th>, so `td:first-of-type` is the VALUE cell — reading it
   as the label is what previously pinned `nowrap` on the value and blew the
   table out sideways on long keyword strings and non-Latin titles. */
.meta-table th {
  width: 110px;
  padding-top: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--muted);
  background: transparent;
  vertical-align: top;
  white-space: nowrap;
}
.meta-table td:first-of-type { word-break: break-word; }
.meta-table td:nth-child(3),
.meta-table td:nth-child(4) {
  width: 60px;
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.meta-table code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.meta-table .desc-pre {
  margin: 0;
  max-height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.55;
  background: transparent;
  border: 0;
  padding: 0;
}

/* Atom breakdown under each field — Apple indexes every word separately, so the
   phrase-level numbers in the keyword table can mislead without this row. */
.meta-table tr.atoms-row td {
  padding-top: 2px;
  padding-bottom: 10px;
  background: transparent;
}
.atom-row { display: flex; flex-wrap: wrap; gap: 2px; }
.atom-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  margin: 2px 4px 2px 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text);
}
.atom-chip small { color: var(--muted); font-size: 10px; }
.atom-chip.atom-nodata { color: var(--muted); border-style: dashed; }
.atom-chip.verdict-relevant { border-color: #86c9a2; background: var(--ok-soft); }
.atom-chip.verdict-tactical { border-color: #86c9a2; background: var(--ok-soft); }
.atom-chip.verdict-mixed { border-color: #e3bb7d; background: var(--warn-soft); }
.atom-chip.verdict-wrong_intent,
.atom-chip.verdict-brand_dominated,
.atom-chip.verdict-off,
.atom-chip.verdict-other_locale,
.atom-chip.verdict-no_results { border-color: #eda9a9; background: var(--err-soft); }

/* =============================================================================
   Keyword table
   ========================================================================== */

.kw-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.kw-controls .kw-filter { max-width: 280px; }
.kw-only-claude { font-weight: 400; margin: 0; }

.kw-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.kw-tab {
  padding: 6px 15px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.kw-tab:hover:not(.active) { background: var(--surface-3); color: var(--text); }
.kw-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.kw-tab .kw-tab-count {
  margin-left: 5px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.kw-tab.active .kw-tab-count { color: rgba(255,255,255,.8); }

.kw-table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.kw-table { font-size: 12.5px; }
.kw-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-3);
  box-shadow: inset 0 -1px 0 var(--border);
  white-space: nowrap;
}
.kw-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.kw-table td:nth-child(3) { white-space: normal; min-width: 200px; }
.kw-table tbody tr:hover > td { background: var(--surface); }
.kw-table details pre { max-height: 260px; overflow: auto; margin: 6px 0 0; }

/* Claude's own proposals, marked so they read apart from harvested keywords. */
.kw-table tr.claude-row td { background: var(--accent-soft); }
.kw-table tr.claude-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.kw-table tbody tr.claude-row:hover > td { background: #e5e3fb; }

/* ---- Expanded detail row ------------------------------------------------- */

.kw-table tr.kw-detail > td {
  background: var(--surface);
  padding: 14px 16px;
  white-space: normal;
}
.kw-detail-summary {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.kw-detail-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.kw-dtab {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.kw-dtab:hover:not(.active) { background: var(--surface-3); }
.kw-dtab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.kw-detail-panes { min-height: 40px; }
.kw-detail-pre {
  margin: 0;
  max-height: 300px;
  overflow: auto;
  font-size: 12px;
}

/* ---- SERP list ----------------------------------------------------------- */

.serp-status { font-size: 12.5px; color: var(--muted); }
.serp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px;
}
.serp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}
.serp-icon { width: 40px; height: 40px; border-radius: 9px; flex: 0 0 40px; object-fit: cover; }
.serp-icon-empty { background: var(--surface-3); }
.serp-meta { min-width: 0; }
.serp-line { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.serp-rank { color: var(--muted); font-variant-numeric: tabular-nums; }
.serp-line a {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.serp-line a:hover { text-decoration: underline; color: var(--accent); }
.serp-sub { font-size: 11.5px; color: var(--muted); }

/* =============================================================================
   Narrative blocks — curated report, audit, explanation
   ========================================================================== */

.curated-report {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.curated-report h4 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.curated-report-item { margin: 0 0 12px; }
.curated-report-item:last-child { margin-bottom: 0; }
.curated-report-item p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; color: var(--text); }

/* Self-review verdict + the before -> after diff it produced. */
.audit-banner { margin: 10px 0 4px; }
.audit-diff { margin: 3px 0 3px 6px; font-size: 13px; }
.audit-diff .audit-old { text-decoration: line-through; color: var(--muted); }
.audit-diff .audit-new { color: var(--ok); }

.explain-report {
  margin: 14px 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: 12px;
  background: var(--ok-soft);
}
.explain-report .explain-head { font-weight: 650; font-size: 14.5px; margin-bottom: 8px; }
.explain-report h4 { margin: 12px 0 4px; font-size: 13px; color: var(--text-2); }
.explain-report p { margin: 4px 0; line-height: 1.55; }
.explain-report ul { margin: 4px 0 8px; padding-left: 20px; }
.explain-report li { margin: 2px 0; line-height: 1.5; }

details.tech-details {
  border-color: var(--border);
  background: var(--surface-2);
}
details.tech-details > summary { color: var(--muted); font-weight: 500; }

/* =============================================================================
   Health probes
   ========================================================================== */

#appfollow-status-row, #proxy-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
#appfollow-checked-at, #proxy-checked-at { margin: 0; }
#proxy-status-list { margin-top: 8px; }
#proxy-status-list .proxy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
#proxy-status-list .proxy-row:last-child { border-bottom: 0; }

/* =============================================================================
   Job history
   ========================================================================== */

#jobs-list { list-style: none; margin: 0; padding: 0; }
#jobs-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
#jobs-list li:hover { background: var(--surface-2); }
#jobs-list li + li { box-shadow: inset 0 1px 0 var(--border); }

.job-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.job-main a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-main a:hover { color: var(--accent); text-decoration: underline; }
.job-time { color: var(--muted); font-size: 12px; white-space: nowrap; }

#jobs-list li.jobs-empty {
  display: block;
  color: var(--muted);
  padding: 18px 12px;
  text-align: center;
}
#jobs-list li.jobs-empty:hover { background: none; }

/* =============================================================================
   Footer
   ========================================================================== */

footer {
  max-width: 1180px;
  margin: 32px auto 0;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

/* =============================================================================
   Responsive + motion
   ========================================================================== */

@media (max-width: 720px) {
  .topbar-inner { padding: 10px 14px; gap: 8px; }
  .brand span:not(.brand-mark) { display: none; }
  .picker-value { max-width: 150px; }
  .picker-panel { width: calc(100vw - 28px); }
  main { padding: 16px 14px 0; gap: 12px; }
  .card { padding: 16px; border-radius: 14px; }
  .row, .row-3 { grid-template-columns: 1fr; }
  #jobs-list li { flex-direction: column; align-items: flex-start; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============================================================ */
/* Run log — captured pipeline output + verdict                 */
/* ============================================================ */

.run-log { margin: 14px 0; }
.run-log > summary { color: var(--text); }

.log-verdict {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.55;
}
.log-verdict .badge { margin-right: 6px; }

.log-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip.chip-warn { background: var(--warn-soft); color: var(--warn); }

/* The lines the verdict rests on — enough to check it without the full dump. */
.log-evidence {
  list-style: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
}
.log-evidence li { margin: 3px 0; }
.log-evidence code {
  font-size: 11.5px;
  color: var(--text-2);
  word-break: break-word;
}

.log-dump {
  max-height: 460px;
  overflow: auto;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ============================================================ */
/* Keyword funnel                                               */
/* ============================================================ */

.funnel { margin: 14px 0; }

.funnel-stage {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
}
.funnel-count {
  min-width: 62px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 15px;
}
.funnel-label { font-size: 13.5px; }
.funnel-scripts { font-size: 12px; color: var(--muted); margin-left: auto; }

/* The drop between two stages — indented under the count column so the
   surviving numbers line up and the losses read as steps between them. */
.funnel-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: 24px;
  padding: 3px 0 3px 14px;
  border-left: 2px solid var(--border-strong);
  font-size: 12px;
  color: var(--err);
}
.funnel-reason {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--err-soft);
  color: var(--err);
  cursor: help;
}
.funnel-note { margin: 0 0 6px 72px; }
.funnel-branch {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.funnel-branch:first-child { margin-top: 0; }

/* ============================================================ */
/* Locale summary                                               */
/* ============================================================ */

.locale-summary { margin: 0 0 16px; }
.locale-summary .kw-table-wrap { max-height: none; }

/* Numeric columns: header and cells share one alignment, or the column reads
   as two columns. Widths are capped so the problem text gets the leftovers. */
.locale-summary .kw-table td.num,
.locale-summary .kw-table th:nth-child(n+3):nth-child(-n+6) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  width: 78px;
}

.summary-row { cursor: pointer; }
.summary-row:hover > td { background: var(--accent-soft); }

/* `.kw-table td` sets nowrap and outranks a bare class, so the verdict was
   clipped at the viewport edge instead of wrapping. */
.locale-summary .kw-table td.summary-problem {
  white-space: normal;
  color: var(--text-2);
  font-size: 12px;
  min-width: 260px;
}

/* ============================================================ */
/* Run presets + collapsible form                               */
/* ============================================================ */

.preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 200px; }

.preset-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.preset-chip button {
  padding: 5px 13px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
}
.preset-chip button:hover:not(:disabled) { background: var(--surface-3); }
.preset-chip .preset-del {
  padding: 5px 9px;
  color: var(--muted);
  border-left: 1px solid var(--border);
}
.preset-chip .preset-del:hover { background: var(--err-soft); color: var(--err); }

/* Submit stays reachable: the form is ~3400px and the button used to sit at
   the very bottom of all of it. */
.submit-bar {
  position: sticky;
  bottom: 0;
  padding: 12px 0 2px;
  background: linear-gradient(to bottom, transparent, var(--surface) 35%);
}

/* 50 locale chips are most of the form's height and are set once per app. */
.countries-details > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 6px 0;
  list-style: none;
}
.countries-details > summary::-webkit-details-marker { display: none; }
.countries-details > summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform .15s ease;
}
.countries-details[open] > summary::before { transform: rotate(90deg); }
