:root {
  --bg: #F7F4F1;
  --surface: #FFFFFF;
  --text: #32281F;
  --accent: #D2622A;
  --muted: #7C746A;
  --border: #E8E1D8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system_ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  font-size: 15px;
}

.app-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 16px;
}

header {
  margin-bottom: 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  font-size: 24px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.user-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.user-field input {
  font-size: 14px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 120px;
  background: #fff;
}

#status {
  margin-top: 8px;
  font-size: 13px;
  color: #A25626;
  min-height: 18px;
}

#status.err { color: #9C3F3F; }

.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  width: fit-content;
  margin-bottom: 16px;
}

.tab {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 7px 18px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.tab.active {
  background: var(--text);
  color: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

.tab:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

main {
  margin-bottom: 20px;
}

.add-job {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: #fff;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.add-job input {
  flex: 1;
  border: none;
  font-size: 15px;
  padding: 8px 4px;
  background: transparent;
  outline: none;
}

.add-job button {
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.add-job button:hover {
  filter: brightness(1.08);
}

.jobs-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(50, 40, 31, 0.08);
  padding: 14px 16px 16px;
  border: 1px solid var(--border);
}

.job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.job-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.pending-count {
  font-size: 11px;
  font-weight: 600;
  background: #F0EBE4;
  color: var(--muted);
  padding: 1px 8px;
  border-radius: 999px;
}

.add-form {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.add-form input[type="text"] {
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.add-form input[name="item"] {
  flex: 1;
  min-width: 0;
}

.add-form input[name="qty"] {
  width: 64px;
}

.add-form button {
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.mat-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mat-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  background: #fff;
  border-radius: 8px;
  font-size: 15px;
}

.mat-list li.bought {
  opacity: 0.75;
}

.mat-list li input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.mat-list label {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 7px;
  min-width: 0;
}

.mat-list .qty {
  background: #F7F4F1;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.mat-list .item {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bought li .item {
  text-decoration: line-through;
  color: var(--muted);
}

.mat-list .added {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  padding-right: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mat-list .delete {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

.mat-list .delete:hover {
  color: #8F4925;
  background: #F6F1ED;
}

.bought-header {
  margin: 12px 4px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 20px 0;
  background: #fff;
  border-radius: 12px;
}

.combined-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.group-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 14px 16px;
}

.group-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.group-card .job-name {
  font-weight: 600;
}

.group-card small {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.combined-header {
  margin-bottom: 10px;
}

.combined-header h2 {
  font-size: 19px;
  margin: 0 0 3px;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* mobile polish */
@media (max-width: 520px) {
  .app-container { padding: 12px; }
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .user-field input { width: 110px; }
  .add-form { flex-wrap: wrap; }
  .add-form input[name="qty"] { width: 52px; }
  .add-job { border-radius: 10px; }
}