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

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

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

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #2c5f8a;
  margin-bottom: 4px;
}

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

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8f0f8;
}

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0dce8;
  border-radius: 8px;
  font-size: 1rem;
  background: #f9fbfd;
  transition: border-color 0.2s;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #4a90d9;
  background: #fff;
}

.unit {
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
}

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

.btn-primary:hover {
  background: #357bb5;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  background: #e8f0f8;
  color: #2c5f8a;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #d0dce8;
}

/* 結果エリア */
.result-card {
  background: #f0f7ff;
  border: 1px solid #c8dff5;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.result-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.result-item.highlight {
  background: #2c5f8a;
  color: #fff;
}

.result-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 4px;
}

.result-item.highlight .result-label {
  color: #b8d4f0;
}

.result-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2c5f8a;
}

.result-item.highlight .result-value {
  color: #fff;
  font-size: 1.3rem;
}

/* プログレスバー */
.progress-area {
  margin-bottom: 12px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 6px;
}

.progress-bar {
  height: 12px;
  background: #d0dce8;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4a90d9;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.progress-fill.danger {
  background: #e05c5c;
}

.progress-fill.warning {
  background: #f0a040;
}

/* 警告 */
.warning {
  background: #fff3cd;
  border: 1px solid #f0c040;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #856404;
}

.warning.danger {
  background: #ffe0e0;
  border-color: #e05c5c;
  color: #8b0000;
}

/* 月別収入 */
.month-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.month-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.month-item label {
  font-size: 0.75rem;
  color: #666;
  margin: 0;
}

.month-item input {
  padding: 7px 8px;
  font-size: 0.85rem;
}

.month-total {
  font-size: 0.9rem;
  color: #444;
  text-align: right;
  margin-top: 12px;
}

.month-total strong {
  color: #2c5f8a;
  font-size: 1rem;
}

/* レスポンシブ */
@media (max-width: 400px) {
  .result-grid {
    grid-template-columns: 1fr 1fr;
  }

  .month-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
