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

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

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

h1 {
  font-size: 1.5rem;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 24px;
}

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

/* フォーム */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

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

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

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: #4a7cdc;
}

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

.btn-primary:hover {
  background: #3564bf;
}

/* サマリー */
.summary-section {
  margin-bottom: 16px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.summary-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.summary-card.warning {
  background: #fff5f5;
}

.summary-label {
  font-size: 0.72rem;
  color: #888;
  margin-bottom: 4px;
}

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

.summary-card.warning .summary-value {
  color: #c0392b;
}

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

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

.sort-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #666;
}

select {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.82rem;
  outline: none;
  cursor: pointer;
}

.legend {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.legend-item {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 12px;
}

.legend-item.weak {
  background: #fff0f0;
  color: #c0392b;
  border: 1px solid #f5c6c6;
}

.legend-item.caution {
  background: #fffbf0;
  color: #d68910;
  border: 1px solid #f5e6c6;
}

.legend-item.good {
  background: #f0fff4;
  color: #27ae60;
  border: 1px solid #c6f5d5;
}

/* 分野カード */
.field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.field-card {
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e8e8e8;
  position: relative;
}

.field-card.weak {
  background: #fff0f0;
  border-color: #f5c6c6;
}

.field-card.caution {
  background: #fffbf0;
  border-color: #f5e6c6;
}

.field-card.good {
  background: #f8fff8;
  border-color: #c6f5d5;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.field-name {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.field-rate {
  font-size: 1.3rem;
  font-weight: 700;
}

.field-card.weak .field-rate { color: #c0392b; }
.field-card.caution .field-rate { color: #d68910; }
.field-card.good .field-rate { color: #27ae60; }

.progress-bar-wrap {
  background: #e8e8e8;
  border-radius: 6px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.field-card.weak .progress-bar { background: #e74c3c; }
.field-card.caution .progress-bar { background: #f39c12; }
.field-card.good .progress-bar { background: #2ecc71; }

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-detail {
  font-size: 0.8rem;
  color: #777;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.btn-edit,
.btn-delete {
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.btn-edit {
  background: #e8f0fd;
  color: #4a7cdc;
}

.btn-edit:hover {
  background: #c8d8f8;
}

.btn-delete {
  background: #fde8e8;
  color: #c0392b;
}

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

.badge-weak {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 700;
}

/* レスポンシブ */
@media (max-width: 500px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
  }

  .form-group {
    min-width: unset;
  }
}
