:root {
  --bg: #0e1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-hover: #1f6feb;
  --green: #3fb950;
  --orange: #d29922;
  --red: #f85149;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  --radius: 8px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa;
    --panel: #ffffff;
    --border: #d0d7de;
    --text: #1f2328;
    --muted: #59636e;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --green: #1a7f37;
    --orange: #9a6700;
    --red: #cf222e;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 760px;
  margin: 32px auto;
  padding: 0 16px 64px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
}

.muted { color: var(--muted); }

code {
  background: var(--panel);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.dropzone {
  margin: 24px 0;
  padding: 40px 24px;
  text-align: center;
  background: var(--panel);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
}

.dropzone.hover {
  background: rgba(47, 129, 247, 0.06);
  border-color: var(--accent);
}

.dz-text {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 500;
}

.dz-or {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.dz-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
}

#filelist-section h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin: 24px 0 8px;
}

#filelist {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#filelist li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

#filelist li:last-child { border-bottom: none; }

#filelist .remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

#filelist .remove:hover { color: var(--red); }

#controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { rotate: 360deg; } }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

#results {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
}

#results th, #results td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-all;
}

#results th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#results tbody tr:last-child td { border-bottom: none; }

.status-regex { color: var(--green); font-weight: 500; }
.status-llm   { color: var(--orange); font-weight: 500; }
.status-failed { color: var(--red); font-weight: 500; }

footer {
  margin-top: 48px;
  font-size: 12px;
  text-align: center;
}
