: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;
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 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); }
.user-chip a { color: var(--muted); }
.user-chip a:hover { color: var(--text); }

.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: left;
}

/* ---------- 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; }

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

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; }

.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; }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  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: right; }

@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: left; }
}
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-left: 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; }
.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-left: 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-left: none; padding-left: 0; }
}
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--border);
  padding-left: 24px;
}
.stat-card:first-child { border-left: none; padding-left: 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 warning and its detail list are one banner: the summary IS the alert
   row, so the count and the way to inspect it never drift apart. */
details.note-issues { padding: 0; }
details.note-issues > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}
details.note-issues > summary::-webkit-details-marker { display: none; }
details.note-issues > summary:hover .note-toggle { color: var(--text); }
.note-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
}
.note-toggle::before {
  content: "▶";
  font-size: 9px;
  transition: transform 0.15s ease;
}
details.note-issues[open] > summary .note-toggle::before { transform: rotate(90deg); }
details.note-issues > 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);
}

/* ---------- Action row ---------- */
.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 44px;
}
.action-row .label { font-size: 12px; color: var(--muted); }
.action-row form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  background: none;
  border: none;
  padding: 0;
  box-shadow: none;
  margin: 0;
}
.action-row .field, .action-row input, .action-row select {
  height: 38px;
  font-size: 13px;
}
.action-row input.language-input { width: 150px; height: 38px; }
.action-row select { height: 38px; font-size: 12px; }
.action-row button[type="submit"] { height: 38px; padding: 0 18px; 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: right;
  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: left; }
table.folder-table td {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  position: relative;
}
table.folder-table td:first-child { text-align: left; }
table.folder-table td.folder-words { font-weight: 600; }
table.folder-table td.folder-pages { color: var(--muted); }
.folder-bar {
  position: absolute;
  left: 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: left; padding: 10px 16px; border-bottom: 1px solid #F0EDE4; }
th {
  position: sticky;
  top: 0;
  background: var(--bg-input);
  text-align: left;
  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: right; white-space: nowrap; }
th:nth-child(3) { text-align: right; }
/* Opt out of / into that positional rule where the column order differs. */
th.col-left { text-align: left; }
th.col-num { text-align: right; }
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: right; }
td.open-cell a { font-size: 12px; white-space: nowrap; }
