:root {
  --bg: #F6F4EF;
  --bg-input: #FBFAF7;
  --card: #FFFFFF;
  --border: #E4E1D6;
  --border-strong: #191712;
  --text: #191712;
  --muted: #6E6A5E;
  --faint: #A5A093;
  --brand: #175E45;
  --brand-hover: #0E4230;
  --brand-tint: #DCE8E1;
  --success-bg: #E1EFE7;
  --success-text: #175E45;
  --warn-bg: #FBF0DC;
  --warn-text: #8A5A10;
  --neutral-bg: #ECEAE2;
  --neutral-text: #6E6A5E;
  --danger-bg: #F9E3DE;
  --danger-text: #A02E1D;
  --blocked-row-bg: #FBF3E2;
  --folder-bar: #E7EFE9;
  /* The CJK and Arabic faces are fallbacks, not downloads: neither webfont
     above has glyphs for ja, ko, zh or ar, and every OS ships one that does. */
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
               'Yu Gothic UI', 'Malgun Gothic', 'Microsoft YaHei', 'Geeza Pro',
               'Noto Sans Arabic', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Hiragino Sans', 'Yu Gothic UI',
               'Malgun Gothic', 'Microsoft YaHei', monospace;
}

* { box-sizing: border-box; }

/* `hidden` has to beat the sizing rules on form controls that set their own
   width/height — without this the attribute is silently ignored on them. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 4rem; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

input, select, button { font-family: inherit; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
::placeholder { color: var(--faint); }

.page-wrap { max-width: 920px; margin: 0 auto; padding: 56px 32px 64px; }
.report-wrap { max-width: 1060px; margin: 0 auto; }

/* ---------- Logo ---------- */
.logo { display: flex; align-items: center; gap: 10px; }
a.logo { color: var(--text); }
a.logo:hover { color: var(--text); text-decoration: none; }
/* The wordmark is a ~4.4:1 lockup, so it sets its own width from a fixed
   height rather than sitting in the square the old "#" placeholder used. */
.logo-img { height: 28px; width: auto; display: block; flex-shrink: 0; }
.logo-img.lg { height: 45px; }
/* Divider between the company mark and the product name, so "wxrks" reads as
   the brand and "Word Counter" as the thing you're looking at. */
.logo-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.logo-name { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.logo-name.lg { font-size: 28px; letter-spacing: -0.5px; }

/* ---------- Top bar (home page) ---------- */
header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px 5px 5px;
  font-size: 13px;
}
.user-chip img, .user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-tint); color: var(--brand);
  font-size: 12px; font-weight: 700;
}
.user-chip .name { font-weight: 500; }
.user-chip .sep { width: 1px; height: 14px; background: var(--border); }

/* The chip is a button now, so it has to shed the global button styling. */
button.user-chip {
  height: auto;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  gap: 8px;
}
button.user-chip:hover { background: var(--card); border-color: #B9B4A4; }
.user-chip .chev { color: var(--muted); font-size: 10px; margin-inline-start: 2px; }
.user-menu.is-open .chev { transform: rotate(180deg); }

.user-menu { position: relative; }
.user-menu-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 232px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(25, 23, 18, 0.12);
}
.user-menu-list a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.user-menu-list a:hover { background: var(--bg); text-decoration: none; }
.user-menu-list a.upgrade-link { color: var(--brand); font-weight: 600; }
.user-menu-head { padding: 8px 10px 10px; }
.user-menu-name { font-size: 13px; font-weight: 600; }
.user-menu-email { font-size: 12px; color: var(--muted); word-break: break-all; }
.user-menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.user-menu-label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.subtitle { font-size: 15px; color: var(--muted); margin: 0 0 14px; }

/* ---------- Toolbar-style crawl form ---------- */
form.crawl-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(25, 23, 18, 0.05);
}

.field {
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 42px;
  padding: 0 14px;
  font-size: 15px;
  background: var(--bg-input);
  box-sizing: border-box;
}

form.crawl-form input[type="url"] {
  flex: 1 1 260px;
  min-width: 200px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 15px;
  font-family: var(--font-mono);
  background: var(--bg-input);
}

select.domain-scope, select#recrawl-domain-scope {
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 42px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text);
}

input.language-input {
  width: 190px;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  background: var(--bg-input);
  text-align: start;
}

/* ---------- Buttons ---------- */
button, .button {
  border: none;
  border-radius: 8px;
  height: 42px;
  padding: 0 26px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--bg);
}
button:hover, .button:hover { background: var(--brand-hover); }
button:disabled { background: var(--faint); cursor: not-allowed; }

/* Both selectors: `.button` is also used on anchors (the landing CTAs, the
   sign-in link), and an element-only rule left those rendering as primaries. */
button.secondary, .button.secondary {
  background: var(--card);
  border: 1px solid #DAD6C9;
  color: var(--text);
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
}
button.secondary:hover, .button.secondary:hover {
  background: var(--card); border-color: #B9B4A4; color: var(--text); text-decoration: none;
}

button.danger-outline {
  background: var(--card);
  border: 1px solid #DAD6C9;
  color: var(--danger-text);
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
}
button.danger-outline:hover { border-color: var(--danger-text); background: var(--card); }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  padding: 0 4px;
}
.checkbox-label input { accent-color: var(--brand); width: 15px; height: 15px; cursor: pointer; }
.checkbox-label:hover { color: var(--text); }

.field-error { color: var(--danger-text); font-size: 0.9rem; margin-top: 0.5rem; }

/* Bar for the admin health page — reads as "how close to a limit" at a glance,
   which the number alone doesn't. */
.meter {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: var(--neutral-bg);
  overflow: hidden;
}
.meter-fill { display: block; height: 100%; background: var(--brand); }
.meter-fill.meter-warm { background: var(--warn-text); }
.meter-fill.meter-hot { background: var(--danger-text); }

/* ---------- Promos: the Ink treatment ----------
   Inverts against a page that is otherwise entirely light, which is what lets
   something this small still get read. The mint is the brand green lifted until
   it holds on near-black — the same hue, not a second one. Only ever one of
   these per page (see rank_page_promos in app/promos.py); a second inverted
   block and the contrast stops meaning anything. */
.promo {
  --promo-ink: #191712;
  --promo-mint: #8FD3B4;
  --promo-paper: #F1EFE9;
  --promo-quiet: #A9A79E;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  position: relative;
  /* Bottom margin matters as much as the top one: this is the last thing
     before the report's own tables, and without it the offer looked attached
     to data it has nothing to do with. */
  margin: 20px 0 36px;
  padding: 15px 20px;
  border-radius: 10px;
  background: var(--promo-ink);
  color: var(--promo-paper);
}
.promo-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
/* The one number the line is about. */
.promo-title strong { color: var(--promo-mint); font-weight: 700; }
/* A light tile behind the mark. These are other companies' assets and arrive
   in whatever colours they ship — several are dark on transparent, which would
   vanish on the near-black behind them. The tile makes any of them legible
   without recolouring somebody's logo, which their brand guidelines usually
   forbid anyway. */
.promo-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-inline-end: 9px;
  vertical-align: -6px;
  background: var(--promo-paper);
  border-radius: 6px;
  flex-shrink: 0;
}
.promo-logo img { display: block; width: 16px; height: 16px; object-fit: contain; }
.promo-body {
  margin: 0;
  flex: 1 1 15rem;
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--promo-quiet);
}
.promo .button,
.promo a.button {
  flex-shrink: 0;
  height: 34px;
  padding: 0 15px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--promo-mint);
  color: var(--promo-ink);
}
.promo .button:hover, .promo a.button:hover { background: #A8DEC4; color: var(--promo-ink); }
.promo .button.secondary {
  background: transparent;
  border: 1px solid var(--promo-quiet);
  color: var(--promo-paper);
}
.promo .button.secondary:hover { background: transparent; border-color: var(--promo-paper); }

/* Mint would read as another accent here; sand says "not the real thing". */
.promo-preview {
  display: inline-block;
  vertical-align: middle;
  margin-inline-start: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Plan ---------- */
.plan-pill {
  background: var(--brand);
  color: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.user-chip a.upgrade-link { color: var(--brand); font-weight: 600; }

/* The line under the estimate's headline duration — the one screen where
   somebody is actively deciding how long they'll wait. */
.estimate-pro-note {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.estimate-pro-note strong { color: var(--brand); }

.pricing-title {
  font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  text-wrap: balance;
}
.pricing-lede { max-width: 40rem; }
.pricing-fineprint { margin-top: 32px; font-size: 13px; max-width: 42rem; }

.plan-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-top: 36px;
}
.plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.plan-card-pro { border-color: var(--brand); }
.plan-price {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 18px;
}
.plan-features { margin: 0 0 20px; padding-inline-start: 18px; font-size: 14px; line-height: 1.9; color: var(--muted); }
.plan-features strong { color: var(--text); }
.plan-current { font-size: 13px; margin: 0 0 12px; }

/* Folded away by default: the exclusions field is for the crawl that needs it,
   not the common one, so it shouldn't compete with the URL box for attention. */
.crawl-advanced { margin-top: 10px; font-size: 13px; }
.crawl-advanced > summary {
  cursor: pointer;
  color: var(--muted);
  padding: 4px 2px;
  list-style-position: outside;
}
.crawl-advanced > summary:hover { color: var(--text); }
.crawl-advanced .advanced-field {
  display: block;
  margin: 8px 2px 6px;
  color: var(--muted);
}
input.exclusions-input {
  width: 100%;
  max-width: 460px;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  background: var(--bg-input);
  box-sizing: border-box;
}
/* Chips rather than a comma-separated box: an entry you can see and delete,
   labelled with whether it will be treated as a folder or a subdomain. */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 460px;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  cursor: text;
  box-sizing: border-box;
}
.tag-input:focus-within { outline: 2px solid var(--brand); outline-offset: -1px; }
.tag-input > input {
  flex: 1 1 120px;
  min-width: 100px;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 2px;
  color: var(--text);
}
.tag-input [data-tag-list] { display: contents; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-tint);
  color: var(--brand);
  border-radius: 6px;
  padding: 4px 4px 4px 9px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
}
/* The half that says how the crawler will read this entry. */
.tag em {
  font-style: normal;
  font-family: var(--font-sans);
  font-size: 11px;
  opacity: 0.7;
}
button.tag-remove {
  background: none;
  border: none;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  height: auto;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.6;
}
button.tag-remove:hover { background: none; opacity: 1; }

.crawl-advanced .advanced-hint { margin: 8px 2px 2px; font-size: 12px; max-width: 560px; }
.crawl-advanced .advanced-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(25, 23, 18, 0.06);
}
.google-btn:hover { border-color: #B9B4A4; box-shadow: 0 2px 6px rgba(25, 23, 18, 0.10); text-decoration: none; }

/* ---------- Landing (public front door) ---------- */
.landing { padding-top: 40px; }
.landing-hero { max-width: 40rem; }
.landing-hero h1 {
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.landing-lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
  margin: 20px 0 0;
  max-width: 34rem;
}
.landing-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.landing-fineprint { font-size: 13px; color: var(--faint); margin: 14px 0 0; }

.landing-points {
  display: grid;
  gap: 28px 40px;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
.landing-point h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.landing-point p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }

.landing-also {
  margin-top: 56px;
  padding: 24px 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 40rem;
}
.landing-also p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--muted); }

.landing-footer {
  border-top: 1px solid var(--border);
  margin-top: 72px;
  padding: 24px 0 48px;
  font-size: 13px;
  color: var(--faint);
}
.landing-footer .page-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
}

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  /* Column, because the language menu sits under the card — as a row they
     rendered side by side, the menu floating oddly next to the sign-in box. */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background-color: var(--bg);
  background-image: radial-gradient(#E6E3D8 1px, transparent 1px);
  background-size: 24px 24px;
}
.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px;
  text-align: center;
}
.login-card .subtitle { max-width: 340px; line-height: 1.5; font-size: 16px; margin: 0; }

/* ---------- Run lists (home page, all runs, admin) ---------- */
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.list-head a { font-size: 13px; font-weight: 600; white-space: nowrap; }
.back-link { font-size: 13px; color: var(--muted); }
.back-link:hover { color: var(--text); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 24px;
}
.filter-row input[type="search"] {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
}
.filter-row a { font-size: 13px; color: var(--muted); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 28px;
  font-size: 13px;
  font-weight: 600;
}
.pagination .muted { font-weight: 400; }
.pagination .disabled { color: var(--faint); }

.section-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
ul.recent-runs { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
ul.recent-runs li { border-bottom: 1px solid var(--border); }
ul.recent-runs a.run-row {
  display: grid;
  /* Fixed tracks rather than auto: every row is its own grid, so auto columns
     size to that row's own content and the numbers wouldn't line up down the
     list. minmax(0, …) lets a long URL ellipsize instead of widening the row. */
  grid-template-columns: minmax(0, 1fr) 132px 84px 100px 172px;
  gap: 20px;
  align-items: center;
  padding: 14px 4px;
  color: var(--text);
  text-decoration: none;
}
ul.recent-runs .run-words, ul.recent-runs .run-pages, ul.recent-runs .run-date { text-align: end; }

@media (max-width: 720px) {
  ul.recent-runs a.run-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
  }
  ul.recent-runs .run-url { flex: 1 0 100%; }
  ul.recent-runs .run-words, ul.recent-runs .run-pages, ul.recent-runs .run-date { text-align: start; }
}
ul.recent-runs a.run-row:hover { background: #FCFBF8; text-decoration: none; }
.run-url { font-family: var(--font-mono); font-size: 13px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-tag {
  margin-inline-start: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}
.run-words { font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.run-pages { font-size: 13px; color: var(--muted); white-space: nowrap; }
.run-date { font-size: 12px; color: var(--faint); white-space: nowrap; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* ---------- Status pills ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  width: fit-content;
}
.status-crawling { background: var(--warn-bg); color: var(--warn-text); }
.status-completed { background: var(--success-bg); color: var(--success-text); }
.status-cancelled { background: var(--neutral-bg); color: var(--neutral-text); }
.status-failed { background: var(--danger-bg); color: var(--danger-text); }
.status-paused { background: var(--brand-tint); color: var(--brand); }
.status-queued { background: var(--neutral-bg); color: var(--neutral-text); }

.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--warn-text);
  animation: wcPulse 1.2s ease-in-out infinite;
}
@keyframes wcPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- Report header ---------- */
.report-header { padding: 28px 32px 8px; }
.report-header a { font-size: 13px; color: var(--muted); }
.report-header a:hover { color: var(--text); }
.report-header h1 {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin: 10px 0 6px;
  word-break: break-all;
}
.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.title-row h1 { flex: 1; }
.header-actions {
  display: flex;
  align-items: center;
  /* Wraps: the Markdown download makes a fourth button here, which is more
     than fits beside a long URL on a narrow screen. */
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  /* Deliberately shrinkable: with flex-shrink:0 the row kept its full natural
     width, so flex-wrap above could never take effect and the buttons ran off
     the side of narrow screens instead. */
  min-width: 0;
  margin-top: 8px;
}
.header-actions #share-btn { gap: 9px; height: 38px; padding: 0 20px; font-size: 13px; }
.header-actions #share-btn svg { width: 15px; height: 15px; }

/* The Export and ⋯ menus — same panel the header's other menus use, because
   they are the same kind of thing. */
.action-menu { position: relative; }
.action-menu > button svg { width: 14px; height: 14px; margin-inline-end: 7px; }
.action-menu > button.action-dots { padding: 0 13px; font-size: 16px; letter-spacing: 1px; }
.action-menu-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 208px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(25, 23, 18, 0.12);
}
.action-menu-list button[role="menuitem"] {
  display: block;
  width: 100%;
  height: auto;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  text-align: start;
  cursor: pointer;
}
.action-menu-list button[role="menuitem"]:hover { background: var(--bg); }
.action-menu-list button.menu-danger { color: var(--danger-text); }
.action-menu-list button.menu-danger:hover { background: var(--danger-bg); }

/* A details whose summary lives elsewhere: the ⋯ menu drives .open, so the
   summary is hidden and only the panel ever shows. */
.run-disclosure-headless > summary { display: none; }
.run-disclosure-headless { flex: 1 1 100%; }
.run-date-line { font-size: 13px; color: var(--muted); margin: 0; }

.settings-applied {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.settings-applied .section-label { margin: 0; }
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.pill strong { font-family: var(--font-mono); }

/* ---------- Sticky stats bar ---------- */
.totals-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 20px;
  align-items: center;
  padding: 14px 32px;
}
/* Flex rather than fixed grid columns: the Markdown card only appears on some
   runs, and a 5-column grid dropped it onto a row of its own. The wrap is a
   genuine fallback for narrow screens, not the desktop layout — the tightened
   gap and padding below are what keep six cards on one row at the 1060px the
   report is capped to. */
.totals-bar .stat-card { flex: 1 1 0; min-width: 0; }
.totals-bar .stat-card:first-child { flex: 0 0 auto; }
.totals-bar .stat-card { padding-inline-start: 18px; }
.totals-bar .stat-card .big { font-size: 21px; letter-spacing: -0.5px; }

@media (max-width: 760px) {
  /* Below this the six cards genuinely can't share a row — wrap them two-up
     rather than letting the unbreakable numbers push the page sideways. */
  .totals-bar { padding: 14px 20px; }
  .totals-bar .stat-card { flex: 1 1 40%; }
  .totals-bar .stat-card:first-child { flex: 1 1 40%; }
  .totals-bar .stat-card:nth-child(odd) { border-inline-start: none; padding-inline-start: 0; }
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-inline-start: 1px solid var(--border);
  padding-inline-start: 24px;
}
.stat-card:first-child { border-inline-start: none; padding-inline-start: 0; gap: 6px; }
.stat-card .muted {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.stat-card .big { font-family: var(--font-mono); font-size: 24px; font-weight: 700; line-height: 1; }
.stat-card-muted .big.zero { color: var(--faint); }

/* ---------- Report body ---------- */
.report-body { padding: 24px 32px 80px; }

.note {
  background: var(--warn-bg);
  border: 1px solid #EAD7AE;
  color: var(--warn-text);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}
.error-box {
  background: var(--danger-bg);
  border: 1px solid #F0C4B8;
  color: var(--danger-text);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
}

/* The blocked/failed count is a chip in the run bar, not a banner across the
   page. It's one fact about the run, and it sits with the control that acts on
   the run rather than interrupting the way to it. */
ul.issues-list { margin: 0 20px 16px; }

ul.issues-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}
ul.issues-list li {
  padding: 8px 12px;
  border-bottom: 1px solid #F0EDE4;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
ul.issues-list li:last-child { border-bottom: none; }
ul.issues-list .issue-url {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
ul.issues-list .issue-reason {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Run bar ----------
   One row: what went wrong with this run, and what to do about it. Replaces two
   full-width fills and a set of controls sitting bare on the page background —
   the only unhoused controls anywhere in the app. */
.run-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}
.run-bar-gap { flex: 1 1 0; min-width: 0; }

/* A disclosure that takes the whole row once open, so the panel it reveals is
   laid out in flow instead of floating over the report beneath it. */
.run-disclosure { min-width: 0; }
.run-disclosure[open] { flex: 1 1 100%; }

.run-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  list-style: none;
}
.run-chip::-webkit-details-marker { display: none; }
.run-chip::after {
  content: "▸";
  font-size: 10px;
  color: var(--faint);
  transition: transform 0.15s ease;
}
.run-disclosure[open] > .run-chip::after { transform: rotate(90deg); }
.run-chip:hover { border-color: #B9B4A4; }

/* Sand, because it carries the same meaning the banner did — just at the size
   of one fact rather than the width of the page. */
.run-chip-warn {
  background: var(--warn-bg);
  border-color: #EAD7AE;
  color: var(--warn-text);
  font-weight: 600;
}
.run-chip-warn::after { color: var(--warn-text); }
.run-chip-warn:hover { border-color: var(--warn-text); }

.run-chip-action { font-weight: 600; }

/* The panel each disclosure opens. */
.run-disclosure[open] > form,
.run-disclosure[open] > ul.issues-list {
  margin-top: 10px;
}
#recrawl-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
#recrawl-form .field,
#recrawl-form input,
#recrawl-form select { height: 34px; font-size: 13px; }
#recrawl-form input.language-input { width: 150px; }
#recrawl-form input.recrawl-exclusions { width: 210px; }
#recrawl-form select { font-size: 12.5px; }
#recrawl-form button[type="submit"] { height: 34px; padding: 0 16px; font-size: 13px; }

/* ---------- Share modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(25, 23, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* display:flex above wins over the hidden attribute unless it's spelled out. */
.modal-overlay[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 16px;
  /* Keeps the footer's fill inside the rounded corners. */
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(25, 23, 18, 0.28);
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
}
.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 22px;
  line-height: 1;
  height: auto;
  padding: 2px 4px;
  margin: -2px -4px 0 0;
}
.modal-close:hover { background: none; color: var(--text); }
.modal-body { padding: 18px 24px 20px; }
.modal-foot {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 18px 24px 20px;
}

.share-invite-row { display: flex; align-items: center; gap: 10px; }
#share-email-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
}
.share-invite-row button[type="submit"] {
  flex-shrink: 0;
  height: 44px;
  padding: 0 22px;
  border-radius: 10px;
  font-size: 14px;
}
#share-email-status { margin: 10px 0 0; }
#share-email-status:empty { display: none; }

.modal-body .section-label { margin: 22px 0 10px; }
.people-list { list-style: none; margin: 0; padding: 0; }
.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}
.person-row .avatar, .icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-tint);
  color: var(--brand);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
}
.icon-circle svg { width: 19px; height: 19px; }
.person-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.person-name { font-size: 15px; font-weight: 600; }
.person-email {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-role { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.person-remove {
  background: none;
  border: none;
  color: var(--faint);
  height: auto;
  padding: 4px 6px;
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}
.person-remove:hover { background: none; color: var(--danger-text); }

.public-link-row { display: flex; align-items: center; gap: 12px; }
.switch {
  flex-shrink: 0;
  justify-content: flex-start;
  width: 46px;
  height: 26px;
  padding: 3px;
  border: none;
  border-radius: 999px;
  background: #CFCBBD;
  transition: background 0.18s ease;
}
.switch:hover { background: #BDB9AA; }
.switch[aria-checked="true"], .switch[aria-checked="true"]:hover { background: var(--brand); }
.switch:disabled { background: var(--border); cursor: not-allowed; }
.switch-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(25, 23, 18, 0.25);
  transition: transform 0.18s ease;
}
.switch[aria-checked="true"] .switch-knob { transform: translateX(20px); }

.share-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
#share-link-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--card);
  color: var(--muted);
}
.share-link-row button { height: 42px; border-radius: 10px; flex-shrink: 0; }

/* ---------- Pre-crawl estimate panel ---------- */
.estimate-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 44px;
  box-shadow: 0 1px 3px rgba(25, 23, 18, 0.05);
}
.estimate-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 4px;
}
.confidence-badge.confidence-high { background: var(--success-bg); color: var(--success-text); border-color: transparent; }
.confidence-badge.confidence-medium { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.confidence-badge.confidence-low { background: var(--neutral-bg); color: var(--neutral-text); border-color: transparent; }
.estimate-duration {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 10px;
}
.estimate-duration .big { font-family: var(--font-mono); font-size: 30px; font-weight: 700; }
.estimate-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin: 14px 0;
}
@media (max-width: 640px) {
  .estimate-stats { grid-template-columns: repeat(2, 1fr); }
}
.estimate-stat .muted {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.estimate-stat .big { font-family: var(--font-mono); font-size: 22px; font-weight: 700; margin-top: 4px; }
#estimate-message { margin: 8px 0 16px; }

/* ---------- Report grid: folders + top pages ---------- */
.report-grid {
  display: grid;
  /* minmax(0, …), not a bare fr: a grid track's default minimum is its
     content's, so one long unbroken URL in the top-pages list would widen
     its column past the page instead of letting .path ellipsize. */
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  margin-bottom: 48px;
}
@media (max-width: 720px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}
#language-section { margin-bottom: 48px; }
.report-grid h2, .report-body > h2, #language-section h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin: 0 0 14px;
}
.report-body > h2 .count { font-size: 13px; font-weight: 500; color: var(--muted); }

table.folder-table { width: 100%; border-collapse: collapse; }
table.folder-table thead th {
  text-align: end;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border-strong);
}
table.folder-table thead th:first-child { text-align: start; }
table.folder-table td {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  text-align: end;
  position: relative;
}
table.folder-table td:first-child { text-align: start; }
table.folder-table td.folder-words { font-weight: 600; }
table.folder-table td.folder-pages { color: var(--muted); }
.folder-bar {
  position: absolute;
  inset-inline-start: 0; top: 4px; bottom: 4px;
  background: var(--folder-bar);
  border-radius: 3px;
  z-index: 0;
}
table.folder-table td > span { position: relative; z-index: 1; }

td.show-all-row, li.show-all-row {
  text-align: center;
  padding-top: 12px;
}
td.show-all-row a, li.show-all-row a {
  font-size: 13px;
  font-weight: 600;
}
li.show-all-row { justify-content: center; }

ol#top-pages-list { list-style: none; padding: 0; margin: 0; }
ol#top-pages-list li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
ol#top-pages-list .rank { font-family: var(--font-mono); font-size: 12px; color: var(--faint); width: 16px; flex-shrink: 0; }
ol#top-pages-list .path {
  font-family: var(--font-mono); font-size: 12px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brand);
}
ol#top-pages-list .words { font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- Pages table ---------- */
.table-scroll {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  max-height: 480px;
  overflow: auto;
  box-shadow: 0 1px 3px rgba(25, 23, 18, 0.05);
}
/* Paginated tables page rather than scroll — an inner scrollbar on top of
   page links makes it unclear which one moves you through the list. */
.table-scroll.table-paged { max-height: none; }

.page-more {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.page-more .muted { font-size: 13px; }
table { width: 100%; border-collapse: collapse; margin: 0; font-size: 13px; }
th, td { text-align: start; padding: 10px 16px; border-bottom: 1px solid #F0EDE4; }
th {
  position: sticky;
  top: 0;
  background: var(--bg-input);
  text-align: start;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  z-index: 2;
}
td.url-cell { font-family: var(--font-mono); font-size: 12px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.words-cell { font-family: var(--font-mono); font-weight: 600; text-align: end; white-space: nowrap; }
th:nth-child(3) { text-align: end; }
/* Opt out of / into that positional rule where the column order differs. */
th.col-left { text-align: start; }
th.col-num { text-align: end; }
tr.page-failed { color: var(--danger-text); }
tr.page-failed td.url-cell { color: var(--danger-text); }
tr.page-blocked-host { color: var(--warn-text); background: var(--blocked-row-bg); }
tr.page-blocked-host td.url-cell { color: var(--warn-text); }
td.open-cell { text-align: end; }
td.open-cell a { font-size: 12px; white-space: nowrap; }

/* ---------- Language menu ----------
   Its own control beside the account chip rather than a row inside it, so the
   current language is legible without opening anything. Same panel treatment
   as the user menu — it is a peer, not a variant. */
.topbar-right { display: flex; align-items: center; gap: 10px; }

.lang-menu { position: relative; }
button.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}
button.lang-btn:hover { background: var(--card); border-color: #B9B4A4; }
.lang-menu.is-open button.lang-btn { border-color: var(--border-strong); }
.lang-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.lang-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lang-menu.is-open .chev { transform: rotate(180deg); }

.lang-menu-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 236px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(25, 23, 18, 0.12);
}
/* Two columns because eleven stacked rows is taller than some windows, and the
   names are short enough to pair. */
.lang-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
a.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
a.lang-option:hover { background: var(--bg); text-decoration: none; }
.lang-option-code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}
a.lang-option.is-current {
  background: var(--brand-tint);
  color: var(--brand);
  font-weight: 600;
}
a.lang-option.is-current .lang-option-code { color: var(--brand); }

/* On the signed-out pages the control sits beside a Sign in button rather than
   an account chip; it needs no other treatment. */
.landing .lang-menu, .login-screen .lang-menu { flex-shrink: 0; }
.login-screen .lang-menu-list { inset-inline-end: auto; inset-inline-start: 50%; transform: translateX(-50%); }
[dir="rtl"] .login-screen .lang-menu-list { transform: translateX(50%); }
