/* Dosta — components. */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--fern); color: var(--on-fern); }
.btn-primary:hover { background: var(--fern-strong); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-soft); }
.btn-danger { background: var(--pohutukawa); color: var(--on-pohutukawa); }
.btn-link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--fern); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.button-row { display: flex; flex-wrap: wrap; gap: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }

/* Form fields */
.field { margin: 0 0 20px; padding: 0; border: 0; }
.field-label { display: block; margin-bottom: 6px; font-weight: 700; }
.field-hint { margin: -2px 0 8px; color: var(--ink-soft); font-size: var(--text-s); }
.input, .select, .textarea {
  width: 100%; max-width: 420px; min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.input-money { max-width: 240px; font-variant-numeric: tabular-nums; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--pohutukawa); }
.field-error { margin: 6px 0 0; color: var(--pohutukawa); font-size: var(--text-s); font-weight: 700; }
.check-row, .radio-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check-row input, .radio-row input { width: 20px; height: 20px; accent-color: var(--fern); }
.radio-group legend { padding: 0; }

/* Status */
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.status--onTrack { color: var(--fern); }
.status--tight { color: var(--kowhai-text); }
.status--short { color: var(--pohutukawa); }

/* Today */
.headline {
  max-width: 24ch; margin: 8px 0 14px;
  font-size: clamp(1.75rem, 3.6vw, var(--text-3xl)); line-height: 1.18; letter-spacing: -0.01em;
}
.headline.is-stale { color: var(--ink-soft); }
.headline.is-updated { animation: br-fade 200ms ease-out; }
@keyframes br-fade { from { opacity: 0.35; } to { opacity: 1; } }

.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 28px; }

.balance-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin: 0 0 28px; padding: 16px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.balance-text { margin: 0; font-size: var(--text-l); font-variant-numeric: tabular-nums; }
.balance-text .muted { font-size: var(--text-s); }

.section { margin: 0 0 36px; }
.section-title { margin: 0 0 14px; font-size: var(--text-l); }

.bar { display: flex; gap: 2px; height: 20px; margin: 0 0 14px; border-radius: 10px; overflow: hidden; }
.bar-seg { flex: 1 1 0; min-width: 6px; }
.bar-seg--bills { background: var(--seg-bills); }
.bar-seg--kept { background: var(--seg-kept); }
.bar-seg--goals { background: var(--seg-goals); }
.bar-seg--buffer { background: var(--seg-buffer); }
.bar-seg--spend { background: var(--seg-spend); }

.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; }
.legend-amount { font-variant-numeric: tabular-nums; font-weight: 700; }

.bill-list { list-style: none; margin: 0; padding: 0; }
.bill-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-areas: "check name amount" ". meta meta";
  align-items: center; column-gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.bill-row input { grid-area: check; width: 20px; height: 20px; accent-color: var(--fern); }
.bill-name { grid-area: name; font-weight: 700; cursor: pointer; }
.bill-amount { grid-area: amount; font-variant-numeric: tabular-nums; font-weight: 700; }
.bill-meta { grid-area: meta; color: var(--ink-soft); font-size: var(--text-s); }
.bill-row.is-paid .bill-name, .bill-row.is-paid .bill-amount { color: var(--ink-soft); text-decoration: line-through; }
.bill-row.is-overdue .bill-meta { color: var(--pohutukawa); font-weight: 700; }
.income-line { margin: 12px 0 0; color: var(--ink-soft); }

/* Notices */
.notice {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 20px; padding: 14px 16px;
  border-radius: var(--radius); background: var(--sky-tint);
}
.notice p { margin: 0; }
.notice .icon { margin-top: 2px; color: var(--ink-soft); }
.notice .button-row { margin-top: 12px; }
.notice--tight { background: var(--kowhai-tint); }
.notice--tight .icon { color: var(--kowhai-text); }
.notice--short { background: var(--pohutukawa-tint); }
.notice--short .icon { color: var(--pohutukawa); }

.fix-list { margin: 0 0 24px; padding-left: 1.2em; }
.fix-list li { margin: 0 0 8px; }

.support {
  padding: 18px 20px;
  border-left: 4px solid var(--fern); border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface);
}
.support-item { margin: 0 0 14px; }
.support-item:last-child { margin-bottom: 0; }
.support-item h3 { margin: 0 0 2px; }
.support-item p { margin: 0; }
.support-lines { font-variant-numeric: tabular-nums; }

/* Explainer */
.calc-line { margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.calc-note { margin: -4px 0 10px; color: var(--ink-soft); font-size: var(--text-s); }
.calc-line--result { padding-top: 10px; border-top: 1px solid var(--line); font-weight: 700; }

/* Dialog */
.dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: var(--radius-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto;
}
.dialog::backdrop { background: rgba(15, 21, 19, 0.45); }
.dialog-form { padding: 24px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.dialog-title { margin: 6px 0 0; font-size: var(--text-xl); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* Toasts */
.toasts {
  position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(520px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
}
.toast .btn-link { color: var(--paper); }
@media (max-width: 900px) { .toasts { bottom: 84px; } }

/* Welcome */
.welcome { max-width: var(--reading); margin: 6vh auto 0; }
.welcome h1 { max-width: 18ch; font-size: clamp(2rem, 5vw, var(--text-3xl)); }
.promise {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 24px 0 28px; padding: 16px 18px;
  border-radius: var(--radius); background: var(--fern-tint);
}
.promise p { margin: 0; }
.promise .icon { margin-top: 2px; color: var(--fern); }
