:root {
  color-scheme: light;
  --background: #f6f8fb;
  --surface: #ffffff;
  --border: #d9e0e8;
  --text: #1d2733;
  --muted: #5d6978;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --success: #1f7a4d;
  --warning: #9a5b00;
  --danger: #b42318;
  --neutral: #52606d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 650;
  min-height: 40px;
  padding: 0 16px;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
}

button:disabled {
  background: #b7c3d1;
  cursor: not-allowed;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1 {
  font-size: 2rem;
  line-height: 1.15;
  margin: 0;
}

.report-link {
  color: var(--accent-dark);
  font-weight: 650;
  text-decoration: none;
}

.report-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.upload-panel {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) auto;
  padding: 16px;
}

.file-control {
  display: grid;
  gap: 6px;
}

.file-title {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
}

input[type="file"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 40px;
  padding: 7px;
  width: 100%;
}

.columns-note {
  color: var(--muted);
  font-size: 0.88rem;
  grid-column: 1 / -1;
  margin: 0;
}

.status-banner {
  border-left: 4px solid var(--neutral);
  margin: 16px 0;
  min-height: 44px;
  padding: 12px 14px;
}

.status-banner.muted {
  background: #edf2f7;
  border-color: var(--neutral);
}

.status-banner.error {
  background: #fff1f0;
  border-color: var(--danger);
  color: var(--danger);
}

.status-banner.success {
  background: #edf9f1;
  border-color: var(--success);
  color: var(--success);
}

.progress-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: -4px 0 16px;
  padding: 12px 14px;
}

.progress-copy {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

#progress-title {
  flex: 0 0 auto;
  font-weight: 700;
}

#progress-detail {
  color: var(--muted);
  font-size: 0.88rem;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.progress-status {
  align-items: baseline;
  display: flex;
  gap: 10px;
  min-width: 0;
}

#progress-percent {
  color: var(--accent-dark);
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 750;
}

.progress-track {
  background: #edf2f7;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  background: linear-gradient(90deg, var(--accent), #35a871);
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width 180ms ease;
  width: 0;
}

.summary-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary-strip div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 72px;
  padding: 12px;
}

.summary-strip span {
  display: block;
  font-size: 1.45rem;
  font-weight: 750;
  line-height: 1.1;
}

.summary-strip small {
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

.actions-row {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.job-state {
  color: var(--muted);
  font-size: 0.92rem;
}

.table-region {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f8;
  color: #303b49;
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--muted);
  height: 76px;
  text-align: center;
  vertical-align: middle;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.status-ready,
.status-processing {
  background: #e8f1ff;
  color: var(--accent-dark);
}

.status-success {
  background: #e4f7ed;
  color: var(--success);
}

.status-failed,
.status-invalid_row,
.status-site_not_found,
.status-serial_not_found,
.status-missing_mac,
.status-duplicate_serial {
  background: #fff1f0;
  color: var(--danger);
}

.status-already_assigned {
  background: #fff6df;
  color: var(--warning);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 18px;
  }

  .topbar,
  .actions-row {
    align-items: stretch;
    flex-direction: column;
  }

  .upload-panel,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .progress-copy {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .progress-status {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  #progress-detail {
    text-align: left;
  }

  h1 {
    font-size: 1.55rem;
  }
}