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

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

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

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e40af;
  text-align: center;
  padding: 20px 0 16px;
  border-bottom: 2px solid #2563eb;
  margin-bottom: 20px;
}

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

/* フォームセクション */
.form-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

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

.form-group:first-child {
  grid-column: 1 / -1;
}

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

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

input:focus {
  outline: none;
  border-color: #2563eb;
}

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

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

/* 合計セクション */
.summary-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 6px;
}

.summary-koji {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e40af;
}

.summary-detail {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 2px;
}

.summary-total {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e40af;
  white-space: nowrap;
}

/* 一覧セクション */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.list-header h2 {
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #6b7280;
}

.filter-group select {
  padding: 5px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #374151;
}

.record-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.record-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.record-koji {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2563eb;
  background: #dbeafe;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
}

.record-main {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.record-sub {
  font-size: 0.82rem;
  color: #6b7280;
}

.record-cost {
  font-size: 1rem;
  font-weight: 700;
  color: #047857;
  white-space: nowrap;
  text-align: right;
}

.btn-delete {
  background: none;
  border: 1px solid #fca5a5;
  color: #ef4444;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

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

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

@media (max-width: 480px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-group:first-child {
    grid-column: 1;
  }
  .summary-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
