:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --success: #3ecf8e;
  --warn: #e8b339;
  --err: #f47174;
  --radius: 8px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

header.site {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

header.site h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

nav a {
  margin-right: 1rem;
}

nav a:last-child {
  margin-right: 0;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.875rem;
}

input[type="file"],
select,
button {
  font: inherit;
}

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  min-width: 12rem;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn.secondary {
  background: var(--border);
  color: var(--text);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.row > div {
  flex: 1 1 200px;
}

.note {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.upload-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

.upload-results li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.upload-results li:last-child {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.ok {
  background: rgba(62, 207, 142, 0.2);
  color: var(--success);
}

.badge.dup {
  background: rgba(232, 179, 57, 0.2);
  color: var(--warn);
}

.badge.err {
  background: rgba(244, 113, 116, 0.2);
  color: var(--err);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tabs button {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
}

.tabs button.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

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

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.search-row {
  margin-bottom: 1rem;
}

.search-row input[type="search"] {
  width: 100%;
  max-width: 24rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: min(90vw, 560px);
  padding: 1rem;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

dialog pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.75rem;
  max-height: 50vh;
  overflow: auto;
}

.empty {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.pipeline-stored {
  display: inline-block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}
