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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

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

h1 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #222;
}

h2 {
  font-size: 1rem;
  color: #555;
  margin-bottom: 10px;
}

.input-section {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input-row input,
.input-row select {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.input-row.triple input[type="text"] {
  flex: 2;
}

.input-row.triple input[type="number"] {
  flex: 1;
  min-width: 100px;
}

button {
  padding: 8px 16px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.2s;
}

button:hover {
  background: #357abd;
}

button.danger {
  background: #e74c3c;
  font-size: 0.85rem;
  padding: 6px 12px;
}

button.danger:hover {
  background: #c0392b;
}

.table-section {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 320px;
}

th, td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

thead th {
  background: #4a90d9;
  color: #fff;
  font-weight: bold;
}

thead th:first-child {
  background: #4a90d9;
}

tfoot td {
  background: #f0f4f8;
  font-weight: bold;
}

tfoot td:first-child {
  background: #f0f4f8;
}

.best-price {
  background: #d4edda !important;
  font-weight: bold;
  color: #155724;
}

.delete-row-btn {
  background: none;
  color: #e74c3c;
  border: none;
  padding: 2px 6px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-left: 4px;
}

.delete-row-btn:hover {
  background: #fde;
  border-radius: 4px;
}

.empty-msg {
  text-align: center;
  color: #999;
  padding: 20px 0;
  font-size: 0.9rem;
}

.vendor-tag {
  display: inline-flex;
  align-items: center;
  background: #e8f0fe;
  border-radius: 4px;
  padding: 2px 6px;
  margin: 2px;
  font-size: 0.85rem;
  color: #333;
}

.vendor-tag button {
  background: none;
  color: #999;
  border: none;
  padding: 0 0 0 4px;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

.vendor-tag button:hover {
  color: #e74c3c;
}

.vendor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  h1 { font-size: 1.2rem; }
  .input-row.triple { flex-direction: column; }
  .input-row.triple input,
  .input-row.triple select { min-width: unset; }
}
