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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 15px;
}

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a1a2e;
  border-left: 4px solid #2563eb;
  padding-left: 10px;
}

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

/* Input section */
.input-section {
  background: #fff;
  border-radius: 8px;
  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: 10px;
  margin-bottom: 12px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
}

input[type="date"],
input[type="number"],
input[type="text"],
select {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.9rem;
  width: 100%;
  background: #fafafa;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
}

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

.btn-add:hover {
  background: #1d4ed8;
}

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

.summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.print-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.title-input {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  width: 200px;
}

.btn-print {
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-print:hover {
  background: #047857;
}

.btn-clear {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-clear:hover {
  background: #b91c1c;
}

.print-title {
  display: none;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #333;
}

/* Tables */
.summary-table,
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.summary-table th,
.summary-table td,
.list-table th,
.list-table td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
}

.summary-table th,
.list-table th {
  background: #f0f4ff;
  font-weight: 600;
  font-size: 0.85rem;
}

.summary-table td:last-child,
.list-table td:nth-child(3) {
  text-align: right;
}

.total-row td {
  font-weight: 700;
  background: #eff6ff;
  font-size: 0.95rem;
}

#total-amount {
  color: #2563eb;
  text-align: right;
}

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

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

.list-table {
  display: none;
}

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

.btn-delete:hover {
  background: #fee2e2;
}

/* Responsive */
@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .summary-header {
    flex-direction: column;
  }

  .title-input {
    width: 100%;
  }

  .list-table th:nth-child(4),
  .list-table td:nth-child(4) {
    display: none;
  }
}

/* Print styles */
@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .print-title {
    display: block !important;
  }

  .input-section,
  .btn-clear {
    display: none !important;
  }

  .summary-section,
  .list-section {
    box-shadow: none;
    border: none;
    padding: 0;
    margin-bottom: 20px;
  }

  h1, h2 {
    color: #000;
  }

  .summary-table th,
  .list-table th {
    background: #eee;
  }
}
