* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 40px 16px;
  min-height: 100vh;
  background: linear-gradient(135deg, #eafbf3 0%, #eaf3ff 100%);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: #222;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(30, 130, 100, 0.15);
}

header {
  text-align: center;
  padding: 36px 24px 28px;
  background: linear-gradient(135deg, #1f9d6b 0%, #1c7fbf 100%);
  color: #fff;
}

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
}

.content {
  padding: 28px 32px 32px;
}

h2 {
  font-size: 18px;
  margin: 0 0 14px;
}

input,
select,
button,
textarea {
  font-family: inherit;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8e0da;
  border-radius: 10px;
  margin-bottom: 10px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  background: #1f9d6b;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(31, 157, 107, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(31, 157, 107, 0.4);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.add-section {
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.add-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: #999;
}

.add-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: #666;
  min-height: 18px;
}

.add-status.error {
  color: #c0392b;
}

.summary-section {
  margin-top: 28px;
}

.summary-boxes {
  display: flex;
  gap: 10px;
}

.summary-box {
  flex: 1;
  padding: 14px 12px;
  border-radius: 14px;
  text-align: center;
  background: #fafafd;
  border: 1px solid #eee;
}

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

.summary-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.summary-value::after {
  content: "円";
  font-size: 12px;
  font-weight: 400;
  margin-left: 2px;
  color: #999;
}

.expense-box .summary-value {
  color: #c0392b;
}

.income-box .summary-value {
  color: #1f9d6b;
}

.balance-box .summary-value {
  color: #1c7fbf;
}

.budget-section {
  margin-top: 28px;
}

.remaining-box {
  text-align: center;
  padding: 20px 12px;
  border-radius: 14px;
  background: #fafafd;
  border: 1px solid #eee;
  margin-bottom: 12px;
}

.remaining-value {
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1c7fbf;
}

.remaining-value::after {
  content: "円";
  font-size: 16px;
  font-weight: 400;
  margin-left: 2px;
  color: #999;
}

.remaining-box.over-budget .remaining-value {
  color: #c0392b;
}

.budget-target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #555;
}

.budget-target-row button {
  padding: 4px 12px;
  font-size: 12px;
  background: #f0efec;
  color: #555;
  box-shadow: none;
}

.budget-target-row button:hover {
  box-shadow: none;
  transform: none;
  background: #e5e4e0;
}

.budget-target-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.budget-target-form input {
  margin-bottom: 0;
}

.insights-section {
  margin-top: 28px;
}

/* カテゴリ別支出バー: 単一の測定量(今月の支出額)をカテゴリで分解しているだけなので、
   カテゴリごとに色を変えず単一色でランク付けする（006と同じ考え方） */
.category-bar-row {
  margin-bottom: 14px;
}

.category-bar-row .category-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.category-bar-row .category-bar-name {
  font-weight: 600;
  color: #333;
}

.category-bar-row .category-bar-value {
  color: #52514e;
  font-variant-numeric: tabular-nums;
}

.category-bar-track {
  height: 20px;
  background: #f0efec;
  border-radius: 4px;
  overflow: hidden;
}

.category-bar-fill {
  height: 100%;
  min-width: 4px;
  background: #1c7fbf;
  border-radius: 0 4px 4px 0;
}

.ai-insight-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed #ddd;
}

.ai-insight-block button {
  background: #1c7fbf;
  box-shadow: 0 4px 12px rgba(28, 127, 191, 0.3);
}

.insight-summary {
  margin: 10px 0 0;
  padding: 12px 14px;
  background: #eaf3ff;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
}

.list-section {
  margin-top: 28px;
}

.transaction-card {
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fafafd;
}

.card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.transaction-name {
  font-weight: 700;
  font-size: 15px;
}

.transaction-category {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e3f6ec;
  color: #1f9d6b;
  vertical-align: middle;
}

.transaction-meta {
  font-size: 12px;
  color: #777;
  margin-top: 4px;
}

.transaction-amount {
  text-align: right;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}

.transaction-amount.expense {
  color: #c0392b;
}

.transaction-amount.income {
  color: #1f9d6b;
}

.card-edit-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #ddd;
}

.card-edit-form .field-row {
  display: flex;
  gap: 8px;
}

.card-edit-form .field-row > * {
  flex: 1;
}

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

.card-actions .delete-btn {
  background: #e74c3c;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.empty-message {
  color: #888;
  font-size: 13px;
}
