.form-group { margin-bottom: 1.1rem; }
.form-group:last-child { margin-bottom: 0; }

/* 金額入力 */
.amount-input-wrap, .period-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.amount-input-wrap input, .period-wrap input { flex: 1; }
.amount-hint {
  font-size: 0.8rem;
  color: var(--text-sub);
  margin-top: 0.3rem;
  min-height: 1.2em;
}

/* 単位トグル */
.unit-toggle, .unit-toggle { display: flex; }
.unit-btn, .period-btn {
  padding: 0.55rem 0.9rem;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-sub);
  font-size: 0.875rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}
.unit-btn:first-child, .period-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-right: none;
}
.unit-btn:last-child, .period-btn:last-child {
  border-radius: 0 6px 6px 0;
}
.unit-btn.active, .period-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* 結果 */
.result-box {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 1.5rem;
  display: none;
}
.result-box.show { display: block; }
.result-monthly-label {
  font-size: 0.875rem;
  color: var(--text-sub);
  font-weight: 500;
  margin-bottom: 0.3rem;
}
.result-monthly {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 1.25rem;
}

.result-row-group { margin-bottom: 1.25rem; }
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; }
.rv { font-weight: 600; color: var(--text); }
.rv-red { color: var(--red); }

/* 割合バー */
.ratio-bar-wrap { margin-bottom: 1.5rem; }
.ratio-bar {
  display: flex;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.ratio-seg { height: 100%; transition: width 0.4s; }
.ratio-principal { background: var(--blue); }
.ratio-interest   { background: var(--red); }
.ratio-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-sub);
  align-items: center;
}
.legend-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 0.25rem;
}
.dot-principal { background: var(--blue); }
.dot-interest  { background: var(--red); }

/* スケジュールテーブル */
.schedule-section { }
.schedule-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 0.6rem;
}
.schedule-scroll { overflow-x: auto; }
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 380px;
}
.schedule-table th {
  background: rgba(59,130,246,0.1);
  padding: 0.45rem 0.6rem;
  text-align: right;
  font-weight: 600;
  color: var(--text-sub);
  border-bottom: 1px solid #bfdbfe;
}
.schedule-table th:first-child { text-align: center; }
.schedule-table td {
  padding: 0.4rem 0.6rem;
  text-align: right;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.schedule-table td:first-child { text-align: center; color: var(--text-sub); }
.schedule-table tbody tr:last-child td { border-bottom: none; }
.td-interest { color: var(--red); }

/* ダークモード */
html[data-theme="dark"] .result-box {
  background: linear-gradient(135deg, #1e3a5f, #0f2d1f);
  border-color: #1e40af;
}
html[data-theme="dark"] .unit-btn:not(.active),
html[data-theme="dark"] .period-btn:not(.active) { background: #1e293b; }
html[data-theme="dark"] .schedule-table th { background: rgba(59,130,246,0.15); border-color: #1e40af; }

@media (max-width: 480px) {
  .result-monthly { font-size: 2rem; }
  h1 { font-size: 1.3rem; }
}
