:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a323d;
  --text: #e6eaf0;
  --muted: #93a1b3;
  --accent: #4c9aff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 14px 28px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 18px; font-size: 14px; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); }

main { max-width: 1240px; margin: 0 auto; padding: 26px 28px 60px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 12px; color: var(--text); }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 22px;
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

label { display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }

input[type=text], input[type=url], input[type=number], select {
  width: 100%; padding: 9px 11px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; color: var(--text);
  font-size: 14px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.checks { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 6px; }
.checks label { display: flex; align-items: center; gap: 7px;
  text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); margin: 0; }

button, .btn {
  background: var(--accent); color: #08111f; border: none; cursor: pointer;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  font-family: inherit;
}
button:hover, .btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--err); border: 1px solid var(--err); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600; }
tbody tr:hover { background: var(--panel-2); }
td.url { max-width: 460px; word-break: break-all; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap; }
.pill.ok, .pill.extracted, .pill.done { color: var(--ok); border-color: #1f5b2c; background: #102a17; }
.pill.pending, .pill.queued { color: var(--muted); }
.pill.running, .pill.fetched { color: var(--accent); border-color: #1d3f6b; background: #10203a; }
.pill.failed, .pill.error, .pill.llm_failed { color: var(--err); border-color: #6b2320; background: #2c1210; }
.pill.cancelled, .pill.rate_limited, .pill.llm_rate_limited, .pill.paused {
  color: var(--warn); border-color: #6b5320; background: #2c2410; }

.stat { background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 3px;
  font-variant-numeric: tabular-nums; }

pre {
  background: #0b0e12; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; overflow: auto; max-height: 460px; font-size: 12.5px;
  line-height: 1.5; color: #d7e2f0;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, monospace;
}
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }

.log { background: #0b0e12; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; max-height: 260px; overflow: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--muted); }
.log div { padding: 1px 0; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.right { text-align: right; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; }
.tags { display: flex; gap: 7px; flex-wrap: wrap; }
.empty { color: var(--muted); text-align: center; padding: 34px; }
.bar { height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden;
  margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.field-list { columns: 2; column-gap: 26px; font-size: 13.5px; }
.field-list li { margin-bottom: 5px; break-inside: avoid; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px;
  padding: 22px; border-top: 1px solid var(--line); }

.brandrow { display: flex; gap: 18px; align-items: flex-start; }
.logo { width: 96px; height: 96px; object-fit: contain; background: #fff;
  border-radius: 8px; padding: 8px; flex: none; }
.brandmeta { flex: 1; min-width: 0; }
.brandname { font-size: 18px; font-weight: 700; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs a { display: block; }
.thumbs img { width: 108px; height: 108px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); }
.rowthumb { width: 40px; height: 40px; object-fit: cover; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel-2); }

tr.clickable-row { cursor: pointer; }
tr.clickable-row:hover { background: var(--panel-2); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(5, 8, 12, 0.72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 20px; z-index: 100; overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; width: 100%; max-width: 760px; max-height: calc(100vh - 96px);
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px; }
.modal-title { font-size: 17px; font-weight: 700; word-break: break-word; }
.modal-url { color: var(--muted); font-size: 12.5px; margin-top: 4px; word-break: break-all; }
.modal-card pre { flex: 1; min-height: 0; margin: 0; }
.modal-foot { margin-top: 14px; text-align: right; }
