:root {
  color-scheme: light;
  --paper: #efeae2;
  --ink: #1b1916;
  --muted: #5c564e;
  --line: #e4d9cc;
  --card: #fbf8f3;
  --ember: #9f3d16;
  --ember-soft: #f6dfd0;
  --pine: #1d4d3e;
  --danger: #8a2b24;
  --shadow: 0 18px 40px rgba(60, 40, 20, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 280px at 0% -10%, rgba(159, 61, 22, 0.08), transparent 55%),
    var(--paper);
  font-family: Outfit, "Segoe UI", sans-serif;
  line-height: 1.45;
}

h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 560; letter-spacing: -0.02em; }

h1 { font-size: clamp(2.2rem, 4vw, 3.5rem); line-height: 1.05; margin: 0 0 10px; }

h2 { font-size: 1.55rem; margin: 0 0 8px; }

a { color: inherit; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(239, 234, 226, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }

.nav { display: flex; gap: 6px; margin-right: auto; }

.nav button {
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
}

.nav button[aria-selected="true"] { background: var(--ink); color: var(--paper); }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }

.mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--ember);
  box-shadow: inset 0 0 0 5px var(--ember), inset 0 0 0 7px var(--paper);
}

.top-stats { margin: 0; color: var(--muted); font-size: 0.92rem; }

main { padding: 32px 0 48px; }

.layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr); gap: 28px; align-items: start; }

.crawl-pane { position: sticky; top: 88px; display: grid; gap: 14px; }

.eyebrow { margin: 0 0 8px; color: var(--ember); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }

.lede, .panel-copy { color: var(--muted); margin: 0 0 18px; max-width: 62ch; }

.search-form { display: flex; gap: 10px; }

.search-form input, .panel input, .panel select, .filters select, .report-criteria input, .report-criteria select {
  width: 100%;
  border: 1px solid #d9d0c3;
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
}

.search-form input { font-size: 1.05rem; }

button, .secondary {
  border-radius: 12px;
  border: 0;
  background: var(--ember);
  color: white;
  padding: 12px 16px;
  font-weight: 600;
}

button.secondary, .secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid #d9d0c3;
}

button.danger { background: transparent; color: var(--danger); border: 1px solid #e4c8c2; }

button:disabled { opacity: 0.6; cursor: wait; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.hint { color: var(--muted); font-size: 0.88rem; margin: 8px 0 0; }

.filters { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin: 22px 0 6px; }

.filters label, .panel label, .report-criteria label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; }

.result-meta { margin: 0; color: var(--muted); }

.results { min-height: 120px; }

.hit { padding: 18px 0; border-top: 1px solid var(--line); }

.hit-domain { margin: 0; color: var(--pine); font-size: 0.86rem; }

.hit h3 { font-size: 1.35rem; margin: 2px 0 6px; }

.hit h3 a { text-decoration: none; }

.hit h3 a:hover { text-decoration: underline; }

.snippet { margin: 0 0 8px; }

.snippet mark { background: #f3c7a4; color: inherit; border-radius: 0.2em; padding: 0 0.12em; }

.hit-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0; color: var(--muted); font-size: 0.86rem; }

.hit-meta button { padding: 4px 8px; font-size: 0.82rem; font-weight: 500; }

.empty { color: var(--muted); padding: 22px 0; }

.more { margin-top: 8px; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.pager p { margin: 0; }

.pager button { padding: 8px 12px; }

.panel, .job {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel form, .jobs { display: grid; gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chips button {
  background: #f3ece3;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 500;
}

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px 18px; }
fieldset legend { width: 100%; font-size: 0.82rem; color: var(--muted); }

.check input { width: auto; }

.job-head, .job-actions { display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.job-actions { flex-wrap: wrap; justify-content: flex-start; }

.job h3 { font-family: Outfit, sans-serif; font-size: 0.98rem; font-weight: 600; margin: 0; word-break: break-word; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #eee6db;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill.running { background: var(--ember-soft); color: var(--ember); }
.pill.completed { background: #dce8e2; color: var(--pine); }
.pill.failed { background: #f3d6d2; color: var(--danger); }

.pill.running::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

.bar { height: 6px; border-radius: 99px; background: #efe6da; overflow: hidden; }

.bar span { display: block; height: 100%; width: 0; background: var(--ember); }
.bar.completed span { background: var(--pine); }
.bar.failed span { background: var(--danger); }
.bar.cancelled span, .bar.pending span { background: #8a8176; }

.job p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.current-url { word-break: break-all; }

.job-error { color: var(--danger); }

.notice {
  background: #f3d6d2;
  color: #6f241e;
  border: 1px solid #e4b2ab;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.foot { padding-bottom: 28px; color: var(--muted); font-size: 0.88rem; }

dialog {
  width: min(720px, calc(100% - 32px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  background: var(--card);
  color: inherit;
  box-shadow: 0 30px 80px rgba(40, 24, 10, 0.28);
}

dialog::backdrop { background: rgba(28, 22, 16, 0.46); }

dialog article { padding: 18px; }

.excerpt-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }

.excerpt-head h3 { margin: 0; font-size: 1.4rem; }

.excerpt-url { margin: 8px 0; word-break: break-all; }

.excerpt-url a { color: var(--pine); }

.excerpt-description { margin: 0 0 10px; }

.excerpt-body {
  white-space: pre-wrap;
  max-height: 50vh;
  overflow: auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reports { padding-top: 8px; }

.report-criteria {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.report-criteria .span-2 { grid-column: span 2; }

.report-actions { display: flex; gap: 8px; align-items: center; }

.batch-form { display: flex; gap: 12px; align-items: end; margin: 16px 0; }

.batch-form + .batch-form { margin-top: 0; }

.batch-form label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; flex: 1; }

.batch-form input { width: 100%; border: 1px solid #d9d0c3; background: white; border-radius: 12px; padding: 12px 14px; }

.batch-toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-top: 8px; }

.batch-toolbar h2 { margin: 0; }

a.secondary { display: inline-flex; align-items: center; text-decoration: none; }

.failure-title { margin: 22px 0 8px; font-size: 1.2rem; }

.pill.high { background: #dce8e2; color: var(--pine); }
.pill.medium { background: var(--ember-soft); color: var(--ember); }
.pill.low { background: #eee6db; color: var(--muted); }

.report-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }

.stat, button.stat {
  display: grid;
  gap: 2px;
  min-width: 108px;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
}

button.stat.active { background: var(--ember-soft); border-color: #e2b79a; }

.stat strong { font-family: Fraunces, Georgia, serif; font-size: 1.45rem; font-weight: 560; line-height: 1.1; }

.stat span { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }

th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }

tr:last-child td { border-bottom: 0; }

.page-title { display: block; font-weight: 600; text-decoration: none; }

.page-title:hover { text-decoration: underline; }

.cell-url {
  display: block;
  max-width: 340px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-error { display: block; margin-top: 4px; color: var(--danger); font-size: 0.8rem; }

.row-actions { margin-top: 6px; }

.row-actions button { padding: 4px 8px; font-size: 0.82rem; font-weight: 500; }

.auth-wrap { max-width: 460px; margin: 12px auto 32px; }

.auth-card {
  display: grid;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card h1 { font-size: clamp(2rem, 4vw, 2.6rem); }

.auth-card label { display: grid; gap: 6px; font-size: 0.86rem; font-weight: 600; }

.auth-card input {
  width: 100%;
  border: 1px solid #d9d0c3;
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
}

.auth-card .notice { margin: 0; }

.captcha-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.captcha-row img { border: 1px solid #d9d0c3; border-radius: 12px; background: white; }

button.link {
  background: none;
  color: var(--ember);
  border: 0;
  padding: 0;
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 900px) {
  .layout, .grid-3, .search-form, .filters, .top-inner, .report-criteria, .batch-form, .batch-toolbar { display: grid; grid-template-columns: 1fr; }
  .report-criteria .span-2 { grid-column: auto; }
  .nav { margin-right: 0; }
  .crawl-pane { position: static; }
  .top-stats { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
