/* Money → Budgets, Projects and Rules. Builds on the shared styles in style.css. */

.back-link { align-self: flex-start; font-weight: 600; font-size: 0.92rem; padding: 4px 0; margin-bottom: -6px; }

/* Budgets */
.period-label { text-align: center; min-height: 44px; justify-content: center; }
.period-sub { font-weight: 500; }
.totals .hero-foot { margin-top: 6px; gap: 12px; flex-wrap: wrap; }
.totals-span { margin-top: 2px; }
.budget-group-sum { font-variant-numeric: tabular-nums; font-weight: 600; }
.budget-row { color: var(--text); }
.budget-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.budget-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.budget-meta .tag { font-size: 0.7rem; }
.banner { text-decoration: none; }

/* Trend chart: each period is a button that shows it. */
.trends .trend-col {
  border: 0; background: transparent; padding: 4px 0 2px; border-radius: 10px; cursor: pointer; color: var(--text);
  font: inherit; min-width: 0;
}
.trends .trend-col:hover { background: var(--surface-2); }
.trends .trend-col.selected { background: var(--accent-soft); }
.trends .trend-col.selected .trend-label { color: var(--accent); }
.trends .trend-bars { gap: 4px; }

/* A category's recent periods, in the budget sheet. */
.mini-trend { --pill: var(--accent); display: flex; flex-direction: column; gap: 8px; }
.mini-bars { position: relative; display: flex; align-items: stretch; gap: 6px; height: 120px; }
.mini-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mini-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.mini-bar { width: 60%; max-width: 26px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--pill); }
.mini-bar.over { background: var(--bad); }
.mini-value { font-size: 0.68rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-label { font-size: 0.72rem; font-weight: 600; }
/* The budget, as a dashed line across the bars. */
.mini-track { position: relative; }
.mini-budget {
  position: absolute; left: -3px; right: -3px; height: 0; pointer-events: none;
  border-top: 2px dashed color-mix(in srgb, var(--text) 40%, transparent);
}

/* Categories */
.cat-row { display: flex; align-items: center; gap: 2px; padding: 0 8px 0 4px; border-bottom: 1px solid var(--border); }
.cat-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 6px;
  border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--text); border-radius: 10px;
}
.cat-main:active { background: var(--surface-2); }
.cat-row .rule-order .icon-btn { min-width: 34px; }
.collapsible { display: flex; flex-direction: column; gap: 8px; }
.collapsible > summary { font-weight: 600; padding: 10px 2px; }
.collapsible > .card { margin-top: 4px; }
.period-setting h2 { margin-bottom: 2px; }
.period-setting p { margin: 4px 0 0; }
.cat-name-row { flex-wrap: nowrap; align-items: flex-start; }
.cat-preview { display: flex; align-items: center; gap: 6px; }
.hint-line { margin: -8px 0 0; }
.palette { margin: 0; }

/* Projects */
a.budget-row { text-decoration: none; }
.project-row { padding-left: 16px; }
.project-row::before { display: none; }
.project-row .bar { margin-top: 8px; }
.project-description { margin: -4px 0 0; white-space: pre-wrap; }
.add-mark {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}
.list-row:disabled { opacity: 0.6; }
.page-header h1 { overflow-wrap: anywhere; }

/* Rules */
.rule-main-pad { padding-left: 10px; }
.rule-main { color: var(--text); }
.rule-row .switch { margin-left: 4px; }
.preview-list { max-height: none; }
.preview-list .list-row { min-height: 48px; }
.condition-top .icon-btn { flex: none; }
.form .conditions { margin: 4px 0; }
.form .field-row { margin: 4px 0; }
.form .preview { margin-top: 4px; }

/* Categories inside others, in the tree. */
.cat-row.cat-sub .cat-main { min-height: 52px; }
.swatch-inherit {
  background: var(--surface-2); color: var(--muted); font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; border: 3px dashed var(--border);
}
.swatch-inherit.selected { border-style: solid; border-color: var(--text); }
.segmented button:disabled { opacity: 0.5; cursor: default; }

/* Rules placeholder: rows shaped like the real ones. */
.skel-order .icon-btn { visibility: hidden; }
.skel-switch { border-radius: 999px; }
.skel-summary-line { font-weight: 600; padding: 10px 2px; }

@media (min-width: 700px) {
  .mini-bars { height: 140px; }
}
