:root {
  color-scheme: light;
  --ink: #1c1915;
  --muted: #5c564c;
  --line: #e4ddd2;
  --paper: #faf7f2;
  --card: #fff;
  --accent: #8c3a2f;
  --error: #a1261b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.45 "Iowan Old Style", Palatino, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
}

.bar, main {
  max-width: 90rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0.5rem;
}

.bar {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
}

.back { color: var(--accent); text-decoration: none; white-space: nowrap; }
h1 { margin: 0; font-size: 1.6rem; }
h2 { margin: 0; font-size: 1.2rem; }
.hint { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.hint a { color: var(--accent); }

.lookup {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.lookup label {
  display: grid;
  gap: 0.25rem;
  font: 600 0.8rem system-ui, sans-serif;
  color: var(--muted);
}

.lookup input, .lookup select, .toolbar input {
  font: 0.95rem system-ui, sans-serif;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.lookup input { min-width: 16rem; }

button {
  font: 600 0.9rem system-ui, sans-serif;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button.ghost, .tab {
  background: transparent;
  color: var(--accent);
  border-color: var(--line);
}

button:disabled { opacity: 0.6; cursor: default; }

.status { font: 0.9rem system-ui, sans-serif; color: var(--muted); min-height: 1.3em; }
.status[data-kind="error"] { color: var(--error); }

.summary { margin: 1rem 0 0.75rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.tabs { display: flex; gap: 0.3rem; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.toolbar input { flex: 1; min-width: 14rem; }
.count { font: 0.85rem system-ui, sans-serif; color: var(--muted); }

.table-wrap {
  margin-top: 0.6rem;
  max-height: calc(100vh - 18rem);
  min-height: 12rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.parts-table {
  width: 100%;
  border-collapse: collapse;
  font: 0.8rem system-ui, sans-serif;
  white-space: nowrap;
}

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

.parts-table th {
  position: sticky;
  top: 0;
  background: #f3eee6;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.parts-table td.desc { white-space: normal; min-width: 16rem; max-width: 32rem; }
.parts-table td.num { text-align: right; }
.parts-table tr.kit td { font-weight: 600; background: #fbf8f3; }
.parts-table tbody tr:hover td { background: #f6efe4; }
