:root {
  --bg: #ffffff;
  --panel: #f4f4f5;
  --text: #1f2937;
  --accent: #3b82f6;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 2rem auto;
  padding: 0 1rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

ol {
  margin-left: 1.25rem;
  margin-bottom: 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.95rem;
}

.form-group input[type="file"] {
  max-width: 300px;
}

.form-group input[type="number"] {
  max-width: 100px;
}

.form-group.full-width {
  width: 100%;
}

button,
button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #2563eb;
}

#download-btn {
  margin-bottom: 1rem;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#controls input[type="text"] {
  max-width: 300px;
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Table styling */
#results > table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-radius: 6px;
  overflow: hidden;
}

/* Cell defaults */
th, td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  white-space: normal;
  word-break: break-word;
}

/* Clickable headers */
th {
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 1;
  cursor: pointer;
}

/* Center numeric columns (3rd onward, excluding last flag col) */
th:nth-child(n+3):not(:last-child),
td:nth-child(n+3):not(:last-child) {
  text-align: center;
}

/* Left-align SKU & Item Name */
th:nth-child(1),
td:nth-child(1),
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

/* Zebra stripes */
tbody tr:nth-child(even) {
  background: #fcfcfd;
}

/* Auto-height rows */
tbody tr {
  height: auto;
}

/* Reserve ~80ch width for Item Name column */
#results > table th:nth-child(2),
#results > table td:nth-child(2) {
  width: 50ch;
}

/* Let all other columns flex around it */
#results > table th:not(:nth-child(2)),
#results > table td:not(:nth-child(2)) {
  width: auto;
}

/* “recalc” flag styling */
th:last-child,
td:last-child {
  color: red;
  font-size: 8px;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  th, td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  form, #controls {
    gap: 0.5rem;
  }
}