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

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

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

header {
  text-align: center;
  padding: 24px 0 16px;
}

header h1 {
  font-size: 1.6rem;
  color: #8b4a2a;
  font-weight: bold;
}

header .subtitle {
  font-size: 0.85rem;
  color: #999;
  margin-top: 4px;
}

.form-section,
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

h2 {
  font-size: 1rem;
  color: #8b4a2a;
  margin-bottom: 14px;
  font-weight: bold;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 4px;
}

.required {
  color: #e05252;
}

.form-row input,
.form-row select {
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fafafa;
  transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: #e8845c;
  background: #fff;
}

.btn-add {
  width: 100%;
  padding: 12px;
  background: #e8845c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}

.btn-add:hover {
  background: #d0694a;
}

.list-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

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

.count {
  font-size: 0.8rem;
  color: #999;
  font-weight: normal;
  margin-left: 4px;
}

.search-input {
  flex: 1;
  min-width: 140px;
  padding: 7px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fafafa;
}

.search-input:focus {
  outline: none;
  border-color: #e8845c;
  background: #fff;
}

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

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-card {
  border: 1px solid #ecddd4;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fffaf7;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.record-card:hover {
  box-shadow: 0 2px 8px rgba(232,132,92,0.15);
}

.record-info {
  flex: 1;
}

.record-name {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
}

.record-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tag {
  font-size: 0.73rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: #f0e4da;
  color: #8b4a2a;
}

.tag.event {
  background: #fde8dc;
  color: #c0502a;
}

.record-amount {
  font-size: 1.1rem;
  font-weight: bold;
  color: #c0502a;
  white-space: nowrap;
}

.record-date {
  font-size: 0.78rem;
  color: #aaa;
  margin-top: 2px;
  text-align: right;
}

.record-memo {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

.btn-delete {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.btn-delete:hover {
  color: #e05252;
}

/* モーダル */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-content h3 {
  font-size: 1.15rem;
  color: #8b4a2a;
  margin-bottom: 16px;
}

.modal-detail-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.modal-detail-row .label {
  color: #999;
  width: 70px;
  flex-shrink: 0;
}

.modal-detail-row .value {
  color: #333;
  font-weight: 500;
}

.modal-amount {
  font-size: 1.4rem;
  font-weight: bold;
  color: #c0502a;
  text-align: center;
  margin: 14px 0;
}

.btn-close {
  width: 100%;
  padding: 10px;
  background: #f0e4da;
  color: #8b4a2a;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}

.btn-close:hover {
  background: #e0cfc4;
}

@media (max-width: 480px) {
  .record-card {
    padding: 12px;
  }

  header h1 {
    font-size: 1.4rem;
  }
}
