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

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

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

h1 {
  font-size: 1.5rem;
  color: #1565c0;
  text-align: center;
  padding: 20px 0 16px;
}

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

/* 次回予約セクション */
.upcoming {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

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

.upcoming-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.upcoming-item.soon {
  background: #fff3e0;
  border-left-color: #ff9800;
}

.upcoming-item.overdue {
  background: #fce4ec;
  border-left-color: #e53935;
}

.upcoming-hospital {
  font-weight: 600;
}

.upcoming-date {
  font-size: 0.82rem;
  color: #666;
}

.upcoming-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  background: #2196f3;
  color: #fff;
  white-space: nowrap;
}

.upcoming-item.soon .upcoming-badge {
  background: #ff9800;
}

.upcoming-item.overdue .upcoming-badge {
  background: #e53935;
}

.no-upcoming {
  color: #aaa;
  font-size: 0.88rem;
}

/* フォームセクション */
.form-section {
  background: #fff;
  border-radius: 12px;
  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;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #555;
  gap: 4px;
}

.required {
  color: #e53935;
}

input[type="text"],
input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="date"]:focus {
  border-color: #2196f3;
}

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

.btn-add:hover {
  background: #1976d2;
}

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

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

.record-card {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}

.record-card.has-next {
  border-left: 4px solid #2196f3;
}

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

.record-hospital {
  font-size: 1rem;
  font-weight: 700;
  color: #1565c0;
}

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

.record-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.record-field label {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 1px;
}

.record-field span {
  color: #444;
}

.record-next {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.record-next-label {
  color: #2196f3;
  font-weight: 600;
}

.record-next-date {
  color: #333;
}

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

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

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

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

  .record-body {
    grid-template-columns: 1fr;
  }
}
