:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #0f6b5f;
  --accent-dark: #0a4b43;
  --danger: #b42318;
  --warn: #936500;
  --ok: #067647;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-weight: 750;
  color: var(--text);
  font-size: 18px;
}

nav { display: flex; gap: 18px; flex: 1; }

.topbar form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.identity {
  color: var(--muted);
  font-size: 13px;
}

.page {
  max-width: 1180px;
  margin: 32px auto;
  padding: 0 24px;
}

.panel, .auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.auth-panel {
  max-width: 420px;
  margin: 80px auto;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.muted {
  color: var(--muted);
  margin: 8px 0 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.stack, .upload-grid, .user-form {
  display: grid;
  gap: 16px;
}

.upload-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  color: #344054;
}

input, select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  font: inherit;
  background: #ffffff;
}

button, .button-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.ghost {
  background: #eef3f2;
  color: var(--accent-dark);
}

.actions {
  display: flex;
  justify-content: flex-end;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: #344054;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f8fafc;
}

tbody tr.row-accepted {
  background: #ecfdf3;
}

tbody tr.row-accepted td:first-child {
  border-left: 4px solid #079455;
}

tbody tr.row-rejected {
  background: #fff1f0;
}

tbody tr.row-rejected td:first-child {
  border-left: 4px solid #d92d20;
}

tbody tr.row-recheck {
  background: #fffaeb;
}

tbody tr.row-recheck td:first-child {
  border-left: 4px solid #dc6803;
}

tbody tr:hover {
  filter: brightness(0.985);
}

.result-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.result-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
}

.legend-dot.accepted { background: #079455; }
.legend-dot.rejected { background: #d92d20; }
.legend-dot.recheck { background: #dc6803; }

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef2f6;
  color: #344054;
  font-weight: 700;
  font-size: 12px;
}

.status.completed { background: #dcfae6; color: var(--ok); }
.status.failed { background: #fee4e2; color: var(--danger); }
.status.processing { background: #fef0c7; color: var(--warn); }

.alert, .notice {
  padding: 12px 14px;
  border-radius: 6px;
  margin: 18px 0;
}

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

.notice {
  background: #fef0c7;
  color: var(--warn);
}

.progress-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 20px;
  background: #fbfcfd;
}

.progress-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.progress-stage {
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
}

.progress-message {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.progress-percent {
  font-weight: 800;
  color: var(--accent-dark);
  font-size: 18px;
}

.progress-track {
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.progress-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.live-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin: 0 5px 0 14px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50% { opacity: 1; transform: scale(1); }
}

.user-form {
  grid-template-columns: 1.5fr 1fr 180px auto;
  margin-bottom: 24px;
}

@media (max-width: 760px) {
  .topbar { height: auto; align-items: flex-start; flex-direction: column; padding: 16px; }
  nav { flex-wrap: wrap; }
  .topbar form { margin-left: 0; }
  .upload-grid, .user-form { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; }
  table { display: block; overflow-x: auto; }
}
