:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --primary: #2457c5;
  --primary-dark: #183d8d;
  --danger: #b42318;
  --success: #067647;
  --warning: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

button,
.button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font: inherit;
}

button:hover,
.button:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.primary:hover {
  background: var(--primary-dark);
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr auto;
  min-height: 64px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--text);
  font-weight: 700;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  border-radius: 6px;
  color: var(--muted);
  padding: 8px 10px;
}

.nav a:hover {
  background: #eef2f7;
  color: var(--text);
  text-decoration: none;
}

.logout {
  align-items: center;
  display: flex;
  gap: 10px;
}

.shell {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 24px 60px;
}

.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10vh auto 0;
  max-width: 420px;
  padding: 28px;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 19px;
  margin-bottom: 14px;
  margin-top: 28px;
}

p {
  color: var(--muted);
  margin: 6px 0 0;
}

.page-head {
  align-items: end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 22px;
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  color: var(--text);
  display: grid;
  gap: 6px;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="date"],
input:not([type]) {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100%;
}

.check {
  align-items: center;
  display: flex;
  gap: 8px;
}

.upload-box,
.inline-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  margin-bottom: 26px;
  padding: 18px;
}

.inline-form {
  align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.drop-zone {
  align-items: center;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  justify-content: center;
  min-height: 150px;
  padding: 24px;
  text-align: center;
}

.drop-zone input {
  max-width: 340px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
}

.message.error {
  border-color: #fecdca;
  color: var(--danger);
}

.message.success {
  border-color: #abefc6;
  color: var(--success);
}

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

table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
  font-weight: 700;
}

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

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

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
}

.badge.completed {
  background: #dcfae6;
  color: var(--success);
}

.badge.failed {
  background: #fee4e2;
  color: var(--danger);
}

.badge.processing {
  background: #fef0c7;
  color: var(--warning);
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 24px;
}

.stats-grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  padding: 16px;
}

.stats-grid strong {
  font-size: 22px;
}

.stats-grid span,
.metrics span {
  color: var(--muted);
}

.result-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 18px;
}

.result-head {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0;
}

details {
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

pre {
  background: #111827;
  border-radius: 8px;
  color: #f9fafb;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

.error-block {
  background: #fff1f0;
  color: var(--danger);
}

.dashboard-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.bar-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 1fr 40px;
  margin-bottom: 10px;
}

meter {
  height: 16px;
  width: 100%;
}

@media (max-width: 780px) {
  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .logout {
    justify-content: space-between;
  }

  .shell {
    padding: 20px 14px 40px;
  }

  .page-head,
  .result-head {
    display: grid;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
