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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fa;
  color: #333;
  font-size: 15px;
  line-height: 1.5;
}

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

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

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

section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

/* フォーム */
.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 label {
  font-size: 0.82rem;
  color: #666;
  font-weight: 600;
}

.form-group input {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #1a6e8e;
}

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

.btn-primary:hover {
  background: #155a76;
}

/* 集計カード */
.year-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #555;
}

.year-select-wrap select {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card {
  background: #f0f7fc;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.card.highlight {
  background: #fff3e0;
  border: 2px solid #f5a623;
}

.card-label {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a6e8e;
}

.card.highlight .card-value {
  color: #d97706;
}

.card-note {
  font-size: 0.72rem;
  color: #999;
  margin-top: 4px;
}

/* 月別集計 */
.monthly-table {
  overflow-x: auto;
}

.monthly-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.monthly-table th,
.monthly-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  text-align: right;
}

.monthly-table th:first-child,
.monthly-table td:first-child {
  text-align: left;
}

.monthly-table th {
  background: #f5f7fa;
  font-weight: 600;
  color: #555;
}

.monthly-table tr:last-child td {
  border-bottom: none;
  font-weight: 700;
  background: #f0f7fc;
}

/* 記録一覧 */
.filter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: #555;
}

.filter-wrap select {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
}

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

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px 12px;
  gap: 8px;
}

.record-info {
  flex: 1;
  min-width: 0;
}

.record-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.record-member {
  background: #1a6e8e;
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.record-date {
  font-size: 0.82rem;
  color: #888;
}

.record-hospital {
  font-size: 0.9rem;
  color: #333;
}

.record-memo {
  font-size: 0.78rem;
  color: #aaa;
}

.record-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.record-amount {
  font-size: 1rem;
  font-weight: 700;
  color: #1a6e8e;
  white-space: nowrap;
}

.btn-delete {
  background: none;
  border: 1px solid #ddd;
  color: #bbb;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-delete:hover {
  border-color: #e74c3c;
  color: #e74c3c;
}

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

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

  .summary-cards {
    grid-template-columns: 1fr;
  }

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