* {
  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: 680px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #222;
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #444;
}

/* Current mileage */
.current-mileage-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.current-mileage-section label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  display: block;
  margin-bottom: 6px;
}

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

.mileage-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}

/* Form section */
.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  display: block;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: #1d4ed8;
}

#addBtn {
  width: 100%;
  margin-top: 6px;
  padding: 10px;
}

#saveMileageBtn {
  white-space: nowrap;
}

/* List section */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.item-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  position: relative;
}

.item-card.warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.item-card.danger {
  border-color: #ef4444;
  background: #fff5f5;
}

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

.item-name {
  font-size: 1rem;
  font-weight: 700;
  color: #222;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: #d1fae5;
  color: #065f46;
}

.status-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.danger {
  background: #fee2e2;
  color: #991b1b;
}

.item-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  font-size: 0.82rem;
  color: #555;
  margin-bottom: 8px;
}

.item-details span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.item-details .label {
  color: #888;
  font-size: 0.75rem;
}

.item-details .value {
  font-weight: 600;
  color: #333;
}

.item-details .value.over {
  color: #dc2626;
}

.delete-btn {
  background: transparent;
  color: #999;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

@media (max-width: 440px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .item-details {
    grid-template-columns: 1fr;
  }
}
