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

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

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  padding: 20px 0 16px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 20px;
}

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

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

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 0.8rem;
  color: #666;
  font-weight: 500;
}

input[type="text"],
input[type="number"] {
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: #4a90d9;
  box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}

.btn-primary {
  background: #4a90d9;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #357abd;
}

/* Summary Section */
.summary-section {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.summary-box {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-label {
  font-size: 0.78rem;
  color: #888;
}

.summary-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #c0392b;
}

#itemCount {
  color: #2c3e50;
}

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

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 14px;
}

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

thead th {
  background: #f1f5f9;
  color: #555;
  font-weight: 600;
  padding: 9px 10px;
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f0f0;
  text-align: center;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f9fbfc;
}

.diff-plus {
  color: #e67e22;
  font-weight: 600;
}

.diff-minus {
  color: #c0392b;
  font-weight: 600;
}

.diff-zero {
  color: #27ae60;
  font-weight: 600;
}

.loss-amount {
  font-weight: 600;
}

.loss-nonzero {
  color: #c0392b;
}

.btn-delete {
  background: none;
  border: none;
  color: #bbb;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.btn-delete:hover {
  color: #c0392b;
  background: #fef2f2;
}

.btn-danger {
  background: none;
  color: #c0392b;
  border: 1px solid #c0392b;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-danger:hover {
  background: #c0392b;
  color: #fff;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #aaa;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 480px) {
  h1 {
    font-size: 1.25rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  thead th,
  tbody td {
    padding: 8px 6px;
    font-size: 0.82rem;
  }

  .summary-value {
    font-size: 1.2rem;
  }
}
