/* Budget Planner shell. Shared visual styles are a standalone local copy. */
.budget-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 36px 0 26px;
}
.budget-heading .stats-head {
  margin: 0;
}
.budget-empty {
  min-height: 320px;
  padding: 52px 36px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 3px 4px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.foundation-label {
  display: inline-block;
  padding: 6px 12px;
  margin-bottom: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--blush);
  font-size: 13px;
  font-weight: 700;
}
.budget-empty h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}
.budget-empty p {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.7;
}
@media (max-width: 650px) {
  .budget-heading {
    margin-top: 28px;
  }
  .budget-empty {
    padding: 32px 24px;
    min-height: 300px;
  }
}
/* Application layout, using the original Allocate Studio tokens and controls. */
:root {
  --terracotta: #a34730;
  --terracotta-bg: #f8e4dc;
}
#app {
  max-width: 1320px;
}
#navigation {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.nav-item {
  padding: 10px 14px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--ink);
  min-height: 44px;
}
@media (hover: hover) {
  .nav-item:hover {
    background: #eeeae1;
  }
}
.nav-item.active {
  background: var(--accent);
  border-color: var(--ink);
  box-shadow: 2px 3px 0 var(--ink);
}
.budget-heading {
  margin: 30px 0 24px;
}
.budget-heading h1 {
  font-size: clamp(24px, 2.6vw, 32px);
}
.budget-heading p {
  font-size: 14px;
  margin-top: 8px;
}
.heading-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.stats-strip {
  margin: 24px 0;
}
.stat-tile small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
}
.stat-value {
  font-size: clamp(22px, 2.4vw, 30px);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
.panel {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 3px 4px 0 var(--ink);
  min-width: 0;
  margin-bottom: 22px;
}
.dashboard-grid > .panel {
  margin-bottom: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.panel h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.panel h2 + * {
  margin-top: 12px;
}
.hint,
.empty-copy {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 14px;
}
.empty-copy {
  padding: 20px 0;
}
.record-list {
  display: grid;
}
.row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px 0;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--ink);
  font-weight: 600;
}
.row-link:last-child {
  border-bottom: 0;
}
@media (hover: hover) {
  .row-link:hover {
    background: #fafaf7;
  }
}
.row-link small,
.schedule-record > .record-amount small,
td small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 5px;
}
.record-name {
  overflow-wrap: anywhere;
  min-width: 0;
}
.record-amount {
  text-align: right;
  flex-shrink: 0;
}
.terracotta,
.overdue {
  color: var(--terracotta) !important;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 14px;
}
th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
thead th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
td:not(:first-child) {
  font-variant-numeric: tabular-nums;
}
.table-link {
  padding: 4px 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.donut-layout {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.donut {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
}
.donut > div {
  background: white;
  border: 1px solid var(--ink);
  border-radius: 50%;
  width: 126px;
  height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 8px;
}
.donut small {
  font-size: 11px;
  color: var(--muted);
}
.donut b {
  font-size: 16px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.chart-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  min-width: 160px;
}
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 9px 0;
  padding-right: 16px;
}
.chart-legend i {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  flex-shrink: 0;
}
.chart-legend span {
  flex: 1;
}
.chart-legend b {
  white-space: nowrap;
}
.meter {
  height: 10px;
  border: 1px solid var(--ink);
  background: #f6f5ef;
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}
.meter span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.allocation {
  margin-bottom: 18px;
}
.allocation > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.allocation small {
  color: var(--muted);
  font-size: 12px;
}
.budget-line {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.budget-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: none;
  padding: 0;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: var(--ink);
}
.budget-label small {
  color: var(--muted);
  font-weight: 400;
}
.over-budget .meter span {
  background: #ff7385;
}
.over-budget > small {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 12px;
}
.filters {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 1fr 0.8fr 1.2fr;
  gap: 12px;
}
.filters label,
.sample-select,
.welcome label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.filters input,
.filters select {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--ink);
  min-height: 44px;
}
/* Filter labels line up with the text inside the fields (border plus inner padding). */
.filters label {
  padding-left: 12px;
}
.filters label > * {
  margin-left: -12px;
  width: calc(100% + 12px);
}
.month-filter {
  display: flex;
  gap: 5px;
}
.month-filter {
  min-width: 0;
}
/* The month field takes what is left next to All; iOS gives date inputs a wide intrinsic size,
   so it is reset to let the field shrink instead of pushing All over the edge. */
.month-filter input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.month-filter input::-webkit-date-and-time-value {
  text-align: left;
}
.month-filter .month-all {
  flex: 0 0 auto;
}
.month-filter .month-all {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.cards-grid > .panel {
  margin: 0 0 22px;
}
.large-value {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  margin: 10px 0;
  overflow-wrap: anywhere;
}
.large-value small {
  font-size: 13px;
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.net-worth {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.net-worth small {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.net-worth b {
  font-size: 18px;
}
.net-worth strong {
  font-size: 24px;
}
.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.sample-select {
  margin-top: 24px;
}
.sample-tag {
  display: inline-block;
  background: var(--butter);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 99px;
  margin-bottom: 14px;
}
.welcome {
  background: #eee7f8;
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}
.welcome h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: -0.04em;
  margin: 12px 0;
  font-size: 25px;
}
.welcome p {
  font-size: 14px;
  line-height: 1.9;
}
.welcome-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: center;
  min-width: 280px;
}
.welcome-actions label {
  grid-column: 1/-1;
}
#editor {
  width: min(680px, calc(100% - 24px));
  background: var(--bg);
  padding: 26px;
}
#editor .form-grid {
  gap: 18px;
}
#editor input:not([type='checkbox']),
#editor select,
#editor textarea {
  width: 100%;
  border: 1.5px solid var(--ink);
  min-height: 46px;
  font-size: 16px;
}
#editor .check-label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
#editor input[type='checkbox'] {
  width: 22px;
  height: 22px;
  accent-color: var(--ink);
}
#editor textarea {
  resize: vertical;
}
#editor .dialog-actions {
  flex-wrap: wrap;
}
#editor .form-error:empty {
  display: none;
}
.btn {
  border-color: var(--ink);
}
.btn.ghost {
  border-color: var(--line);
}
.calendar-entry {
  display: block;
  width: 100%;
  background: #e6ddf8;
  border: 0;
  border-radius: 6px;
  padding: 6px;
  text-align: left;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.calendar-entry small {
  display: block;
  font-size: 11px;
  margin-top: 3px;
}
.calendar-entry.income {
  background: var(--accent);
}
.cal-day {
  cursor: default;
  min-height: 120px;
}
@media (hover: hover) {
  .calendar-entry:hover {
    outline: 1px solid var(--ink);
  }
}
@media (max-width: 1000px) {
  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filters {
    grid-template-columns: repeat(3, 1fr);
  }
  .welcome {
    flex-direction: column;
  }
  .welcome-actions {
    min-width: 0;
    grid-template-columns: 1fr 1fr 1fr;
  }
  .welcome-actions label {
    grid-column: auto;
  }
  .donut-layout {
    justify-content: center;
  }
}
@media (max-width: 700px) {
  #app {
    padding: 20px 14px 60px;
  }
  .dashboard-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .stats-strip {
    grid-template-columns: 1fr 1fr;
  }
  .panel {
    padding: 18px;
  }
  .budget-heading {
    align-items: flex-start;
  }
  .heading-actions {
    width: 100%;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  /* Month gets a full row so the month name fits; Account and Search share the last row. */
  .filters label:first-child {
    grid-column: 1/-1;
  }
  .welcome {
    padding: 20px;
  }
  .welcome-actions {
    grid-template-columns: 1fr 1fr;
  }
  .welcome-actions label {
    grid-column: 1/-1;
  }
  .nav-item {
    font-size: 12px;
    padding: 8px 10px;
  }
  #navigation {
    gap: 5px;
  }
  .calendar-entry {
    font-size: 10px;
    padding: 4px 2px;
  }
  .calendar-entry small {
    font-size: 10px;
  }
  .cal-day {
    min-height: 90px;
    padding: 4px 2px;
  }
  .cal-grid {
    gap: 3px;
  }
  .donut-layout {
    justify-content: flex-start;
  }
  .net-worth {
    align-items: flex-start;
  }
  .net-worth > span {
    display: none;
  }
  .net-worth > div {
    min-width: 45%;
  }
  .record-name small {
    font-size: 11px;
  }
  .record-amount {
    font-size: 13px;
  }
  .budget-label {
    font-size: 12px;
  }
  .stats-head h1 {
    font-size: 24px;
  }
  .wordmark small {
    letter-spacing: 0.08em;
  }
  #editor {
    padding: 20px 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}
#setup-custom-currency[hidden] {
  display: none;
}
.panel .form-grid input,
.panel .form-grid select {
  border: 1.5px solid var(--ink);
  min-height: 46px;
}
.record-name small.terracotta {
  color: var(--terracotta);
}

/* Keep dashboard amounts and payment statuses, without supporting captions. */
.dashboard-view .stat-tile > small,
.dashboard-view .hint,
.dashboard-view .record-name > small {
  display: none;
}
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.cal-toolbar .screen-switch {
  margin-bottom: 0;
}
.calendar-preferences {
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
}
.calendar-preferences label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}
.calendar-preferences select {
  border: 1.5px solid var(--ink);
}
.setup-section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  margin: 30px 0 20px;
}
.setup-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}
.setup-category:last-child {
  border-bottom: 0;
}
.setup-category.is-hidden .table-link {
  color: var(--muted);
  text-decoration: line-through;
}
.group-budget {
  margin-bottom: 12px;
  background: #f5f3f9;
  border-radius: 10px;
  padding: 0 12px;
}
.group-budget .row-link {
  min-height: 48px;
}
.setup-categories .table-link {
  text-decoration: none;
}
.setup-category .textbtn {
  flex-shrink: 0;
}
.preferences-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}
.setup-group {
  margin: 0 0 26px;
  padding: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.setup-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 10px 0;
}
.setup-group-head h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 19px;
  margin: 0;
  font-weight: 700;
}
.setup-group .setup-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 48px;
  gap: 20px;
  padding: 10px 0 10px 16px;
  border-bottom: 0;
}
.setup-group .table-link {
  font-size: 14px;
  font-weight: 500;
}
.subcategory-budget {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.subcategory-budget span {
  font-size: 11px;
  color: var(--muted);
}
.subcategory-budget input {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--ink);
  font-size: 14px;
  padding: 8px 10px;
}
.setup-section-title {
  font-size: 24px;
  font-weight: 800;
  margin-top: 32px;
}
.setup-expenses {
  margin-bottom: 28px;
}
@media (max-width: 600px) {
  .setup-group .setup-category {
    grid-template-columns: minmax(0, 1fr) 110px 40px;
    gap: 8px;
    padding-left: 0;
  }
  .setup-group .table-link {
    font-size: 13px;
  }
  .subcategory-budget span {
    font-size: 10px;
  }
}

.editable-heading {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 4px 0;
  cursor: pointer;
}
@media (hover: hover) {
  .editable-heading:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
  }
}

.budget-value {
  width: 100%;
  min-height: 38px;
  border: 1.5px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
@media (hover: hover) {
  .budget-value:hover {
    background: #f5f3f9;
    border-color: var(--line);
  }
}

.breakdown-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}
.transaction-types {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background: var(--card);
  margin-bottom: 24px;
}
.transaction-types .switch-pill {
  flex: 1;
  min-width: 0;
}
/* Same pink as the screen switches. */
.transaction-types .switch-pill.active {
  background: var(--blush);
  color: var(--ink);
}
/* Recurring templates and dated payments */
.schedule-record {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.schedule-record > .row-link {
  flex: 1;
  min-width: 0;
  border-bottom: 0;
}
/* Payment rows: check box, name, amount (fixed width so amounts line up), pencil. */
.payment-row > .record-amount {
  flex: 0 0 104px;
  padding: 12px 0;
  font-weight: 600;
}
.pay-check {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 7px;
  background: var(--card);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
}
@media (hover: hover) {
  .pay-check:hover {
    background: #f3fad9;
  }
}
.pay-check.is-done {
  background: var(--blush);
}
@media (hover: hover) {
  .pay-check.is-done:hover {
    background: #eaa3c6;
  }
}
.pay-check.is-empty {
  border-style: dashed;
  border-color: var(--muted);
  cursor: default;
}
.schedule-totals {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.schedule-totals span {
  display: flex;
  gap: 12px;
  align-items: center;
}
.calendar-entry.status-upcoming {
  background: #ddd0f3;
}
.calendar-entry.status-due {
  background: #ffe58a;
}
.calendar-entry.status-overdue {
  background: #ffb2bd;
}
.calendar-entry.status-paid {
  background: transparent;
  color: var(--muted, #626267);
  opacity: 1;
}
.calendar-entry.status-paid > span {
  text-decoration: none;
}
.calendar-paid-check {
  color: var(--blush);
  -webkit-text-stroke: 0.45px var(--ink);
  paint-order: stroke fill;
  font-style: normal;
  font-weight: 800;
  margin-right: 4px;
}
.calendar-entry.status-skipped {
  background: transparent;
  color: var(--muted, #626267);
}
.calendar-entry.status-skipped > span {
  text-decoration: line-through;
}
@media (max-width: 700px) {
  .schedule-record {
    flex-wrap: wrap;
    gap: 0;
    padding-bottom: 10px;
  }
  .schedule-record > .row-link {
    flex-basis: 100%;
  }
  .schedule-record.payment-row {
    flex-wrap: nowrap;
    gap: 10px;
    padding-bottom: 0;
  }
  .payment-row > .row-link {
    flex-basis: auto;
  }
  .payment-row > .record-amount {
    flex-basis: auto;
  }
  .schedule-totals {
    gap: 12px;
  }
  .schedule-totals span {
    width: 100%;
    justify-content: space-between;
  }
}

/* Income shares the original lime date band above the bill list. */
.calendar-paydays {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
}
.calendar-paydays .payday-pill {
  font-size: 11px;
}
.calendar-paydays .payday-pill.is-skipped {
  text-decoration: line-through;
  opacity: 0.6;
}
.day-heading.has-payday {
  margin-bottom: 6px;
}
.skipped-payments:empty {
  display: none;
}
.skipped-payments {
  margin-top: 22px;
}
.skipped-payments h3 {
  font-size: 16px;
  margin-bottom: 8px;
}
.skipped-payment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.debt-chart svg {
  display: block;
  width: 100%;
  max-height: 280px;
}
.debt-chart > div,
.debt-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
}
.debt-card-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
}
/* Actions stay on one line at the right edge of the card. */
.debt-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.debt-card-actions .btn {
  white-space: nowrap;
}
.debt-card-summary p {
  font-size: 13px;
  margin-top: 8px;
}
.paid-off-label {
  background: #d8f3de;
  color: #2f7d4c;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
}
.debt-schedule {
  margin-top: 20px;
}
.debt-schedule .current-month {
  background: #f3fad9;
}
.debt-schedule .payment-complete,
.debt-schedule .payment-future {
  color: var(--muted);
}
.debt-schedule .payment-partial,
.debt-schedule .payment-missed {
  color: #c82449;
  font-weight: 700;
}
.debt-table-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}
@media (max-width: 650px) {
  .debt-card-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .debt-card-actions {
    flex-wrap: wrap;
  }
  .debt-card-actions .btn {
    flex: 1 1 auto;
  }
  .debt-card-footer {
    align-items: center;
  }
  .debt-schedule th,
  .debt-schedule td {
    padding: 12px 7px;
    white-space: nowrap;
  }
}

.debt-priority-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  margin-right: 6px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  /* Same pink as the active Recurring / Payment Schedule switch. */
  background: var(--blush);
  font-size: 14px;
  vertical-align: middle;
}

/* Shared metric-card sizing across Dashboard and Debt Payoff. */
.stats-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}
.stats-strip .stat-tile {
  box-sizing: border-box;
  min-height: 104px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  border-radius: 16px;
}
.stats-strip .stat-label {
  font-size: 14px;
  line-height: 20px;
  margin: 0;
}
.stats-strip .stat-value {
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.2;
  margin: 0;
}
.stats-strip .stat-tile > small:empty {
  display: none;
}
@media (max-width: 850px) {
  .stats-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .stats-strip .stat-tile {
    min-height: 92px;
    padding: 12px 16px;
  }
  .stats-strip .stat-value {
    font-size: 24px;
  }
}
@media (max-width: 450px) {
  .stats-strip {
    gap: 10px;
  }
  .stats-strip .stat-tile {
    min-height: 80px;
    padding: 12px;
    gap: 4px;
    border-radius: 14px;
  }
  .stats-strip .stat-label {
    font-size: 13px;
    line-height: 18px;
  }
  .stats-strip .stat-value {
    font-size: 20px;
  }
}

.screen-switch .switch-pill.active {
  background: var(--blush);
  color: var(--ink);
}
.enhanced-debt-chart svg {
  max-height: none;
  width: 100%;
  display: block;
  overflow: visible;
}
.enhanced-debt-chart svg text {
  font-family: 'Budget Digits', 'DM Sans', sans-serif;
  font-size: 12px;
  fill: var(--muted);
}
.enhanced-debt-chart svg .chart-finish {
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}
.chart-gridline {
  stroke: var(--line);
  stroke-width: 1;
}
.chart-selected,
.chart-baseline {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.chart-selected {
  stroke: var(--ink);
}
.chart-baseline {
  stroke: #8b8994;
  stroke-dasharray: 7 6;
}
.chart-line-key {
  width: 24px;
  border-top: 3px solid var(--ink);
}
.chart-line-key.dashed {
  border-top: 2px dashed #8b8994;
}
.debt-chart-hit {
  cursor: crosshair;
}
.debt-chart-tooltip {
  display: block;
  min-height: 40px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 8px;
  line-height: 1.5;
}
@media (max-width: 650px) {
  .enhanced-debt-chart {
    overflow-x: auto;
  }
  .enhanced-debt-chart svg {
    min-width: 620px;
  }
}
.enhanced-debt-chart {
  overflow: visible;
}
.enhanced-debt-chart svg {
  min-width: 0;
}
.debt-chart-plot {
  position: relative;
  min-width: 0;
}
/* Higher specificity than the legacy .debt-chart > div flex row. */
.debt-chart > .debt-chart-plot {
  display: block;
}
.debt-chart > .chart-mobile {
  display: none;
}
/* The desktop SVG scales with its box (viewBox 940 wide), so font sizes are in
   viewBox units. Step them by rendered width to keep labels about 12-16px. */
.chart-desktop {
  container-type: inline-size;
}
@container (max-width: 699px) {
  .chart-desktop svg text {
    font-size: 21px;
  }
  .chart-desktop svg .chart-finish {
    font-size: 23px;
  }
}
@container (min-width: 700px) and (max-width: 899px) {
  .chart-desktop svg text {
    font-size: 16.5px;
  }
  .chart-desktop svg .chart-finish {
    font-size: 18px;
  }
}
@container (min-width: 900px) and (max-width: 1099px) {
  .chart-desktop svg text {
    font-size: 13.5px;
  }
  .chart-desktop svg .chart-finish {
    font-size: 15px;
  }
}
.debt-chart-tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  max-width: min(270px, calc(100% - 8px));
  min-height: 0;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 2px 3px 0 var(--ink);
  padding: 8px 10px;
  text-align: left;
  font-size: 12px;
  line-height: 1.4;
}
.debt-chart-tooltip[hidden] {
  display: none;
}
.chart-hover-marker,
.chart-baseline-marker {
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}
@media (max-width: 599px) {
  .debt-chart > .chart-desktop {
    display: none;
  }
  .debt-chart > .chart-mobile {
    display: block;
  }
  .chart-mobile svg text,
  .chart-mobile svg .chart-finish {
    font-size: 15px;
  }
  .debt-chart-tooltip {
    font-size: 12px;
    max-width: 220px;
  }
}

/* Debt Payoff: strategy controls on the left, balance chart on the right. */
.debt-overview {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.6fr);
  align-items: stretch;
  gap: 22px;
  margin-bottom: 22px;
}
.debt-overview > .panel {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.debt-overview .panel-head {
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 18px;
}
.debt-overview .panel-head h2 {
  white-space: nowrap;
}
/* When the strategy panel is taller, center the chart in the free space. */
.debt-overview .debt-chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
}
.extra-payment-control {
  margin-bottom: 22px;
}
.extra-payment-input {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
}
.extra-payment-input:focus-within {
  box-shadow: 0 0 0 3px var(--accent);
}
.extra-payment-input:has([aria-invalid='true']) {
  border-color: #c82449;
}
.extra-payment-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}
.extra-payment-input > span {
  color: var(--muted);
  font-size: 14px;
}
.extra-payment-quick {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.extra-payment-quick .btn {
  flex: 1;
  padding: 7px 0;
  border-color: var(--ink);
  font-size: 13px;
}
.strategy-options {
  display: grid;
  gap: 10px;
}
.strategy-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 2px 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
@media (hover: hover) {
  .strategy-option:hover {
    border-color: var(--ink);
  }
}
.strategy-option:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.strategy-option.is-selected {
  border-color: var(--ink);
  background: var(--blush);
  box-shadow: 2px 3px 0 var(--ink);
}
.strategy-option-text,
.strategy-option-figures {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.strategy-option-figures {
  text-align: right;
  white-space: nowrap;
}
.strategy-option-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
}
.strategy-option-hint,
.strategy-option-figures > span {
  color: var(--ink-soft);
  font-size: 13px;
}
.strategy-option-figures > strong {
  font-size: 17px;
}
.strategy-option-figures > span {
  font-size: 12px;
}
.strategy-option-benefit {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.strategy-option-benefit::before {
  content: '✓';
  font-weight: 800;
}
.chart-legend-inline {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}
.chart-legend-inline > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
@media (max-width: 1100px) {
  .debt-overview {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* The chart column is narrower beside the strategy panel. */
@container (max-width: 499px) {
  .chart-desktop svg text {
    font-size: 25px;
  }
  .chart-desktop svg .chart-finish {
    font-size: 27px;
  }
}

/* Debt cards: tighter vertical rhythm, links flush with the right edge. */
.debt-list > .panel > .panel-head {
  align-items: flex-start;
  margin-bottom: 12px;
}
.debt-list .debt-card-summary .large-value {
  margin: 0 0 6px;
}
.debt-list .debt-card-summary p {
  margin-top: 0;
}
.debt-list .meter {
  margin: 14px 0 0;
}
.debt-card-footer {
  align-items: center;
  margin-top: 2px;
}
.debt-list .textbtn {
  padding-right: 0;
}
/* Edit keeps its 40px touch target but centres on the 30px title line. */
.debt-list > .panel > .panel-head > .textbtn {
  margin: -5px 0 0;
}
@media (max-width: 450px) {
  .debt-card-actions {
    flex-wrap: nowrap;
  }
  .debt-card-actions .btn {
    flex: 1 1 0;
    padding: 9px 10px;
    font-size: 13px;
  }
}

/* Savings: two goal cards per row, laid out like debt and account cards. */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}
.goal-grid > .panel {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.goal-status {
  /* Sits in the card title, so reset the heading font and its tight letter spacing. */
  font-family: 'Budget Digits', 'DM Sans', sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.goal-status.is-good {
  background: #d8f3de;
  color: #2f7d4c;
}
.goal-status.is-warn {
  background: #fbdce6;
  color: #b23a66;
}
@media (max-width: 800px) {
  .goal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Narrow calendars: one-line names with an ellipsis and whole amounts, no mid-word breaks. */
.cal-amount-short {
  display: none;
}
@media (max-width: 1000px) {
  .calendar-entry {
    overflow-wrap: normal;
  }
  .calendar-entry .cal-entry-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .calendar-entry small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .calendar-entry .cal-amount,
  .calendar-entry .cal-entry-status {
    display: none;
  }
  .calendar-entry .cal-amount-short {
    display: inline;
  }
}

/* Debt card title: the priority number is centred on the name line and the
   "Extra payment first" label lines up under the name, not under the number. */
.debt-list > .panel > .panel-head h2 {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}
.debt-list > .panel > .panel-head .debt-priority-badge {
  margin-right: 0;
}

.large-value.is-negative {
  color: var(--blush-ink);
}

/* Accounts: two cards per row; the type chip and flow chips use the Bill Calendar chip colours. */
.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}
.account-card {
  margin: 0;
}
.account-card > .panel-head {
  align-items: flex-start;
  margin-bottom: 10px;
}
.account-card > .panel-head h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.account-card > .panel-head > .textbtn {
  margin: -7px 0 0;
  padding-right: 0;
}
.account-kind {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.kind-checking {
  background: #d8ecfb;
  color: #2a6ca8;
}
.kind-savings {
  background: #d8f3de;
  color: #2f7d4c;
}
.kind-cash {
  background: #fcefc0;
  color: #8a6d12;
}
.kind-investment {
  background: #e6ddf8;
  color: #5b3f99;
}
.kind-other-asset {
  background: #fbdce6;
  color: #b23a66;
}
.account-card .large-value {
  display: block;
  margin: 0;
}
.account-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.flow-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.flow-chip.flow-in {
  background: #d8f3de;
}
.flow-chip.flow-out {
  background: #fbdce6;
}
.account-flow small {
  color: var(--muted);
  font-size: 12px;
}
.account-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.account-card-foot .textbtn {
  padding-right: 0;
  white-space: nowrap;
}
@media (max-width: 800px) {
  .account-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Dashboard: Month / Year views */
.dashboard-view > .screen-switch {
  margin: 4px 0 0;
}
.dashboard-view .stats-strip {
  margin-top: 22px;
}
.dashboard-view > .screen-switch + .welcome {
  margin-top: 22px;
}
.year-picker .mp-trigger {
  padding: 6px 12px;
  font-variant-numeric: tabular-nums;
}
.expected-table th:not(:first-child),
.expected-table td {
  text-align: center;
  white-space: nowrap;
}
.budget-group .budget-label {
  cursor: pointer;
  align-items: center;
}
.budget-group .budget-label > span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.budget-chevron {
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  width: 12px;
  transition: transform 0.15s;
}
.budget-group.is-open .budget-chevron {
  transform: rotate(90deg);
}
.budget-group .meter {
  margin-top: 8px;
}
.budget-cats {
  margin: 10px 0 4px 20px;
}
.budget-cat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 96px;
  align-items: center;
  gap: 14px;
  padding: 6px 0;
  font-size: 13px;
  border-top: 1px dashed var(--line);
}
.budget-cat > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.budget-cat > b {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.budget-cat.over-budget > b:first-of-type {
  color: var(--terracotta);
}
.budget-cat-plan {
  text-align: right;
  color: var(--muted);
}
.budget-input {
  width: 100%;
  min-height: 30px;
  padding: 3px 6px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  font: inherit;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.budget-input:focus {
  outline: none;
  border-color: var(--ink);
}
.budget-input.is-own {
  border-color: var(--ink);
  background: var(--blush);
}
.year-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  height: 260px;
}
.year-num {
  min-height: 15px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.year-num.in {
  color: var(--ink);
  font-weight: 600;
}
.year-num.out {
  color: var(--muted);
  font-weight: 400;
  margin-top: -6px;
}
.year-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 6px 2px 4px;
  border: 0;
  border-radius: 10px;
  text-align: center;
  color: var(--ink);
}
.year-bars {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.year-bars i {
  width: min(16px, 40%);
  min-height: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 4px 4px 0 0;
}
.year-in {
  background: var(--mint);
}
.year-out {
  background: var(--blush);
}
.year-label {
  font-size: 12px;
  color: var(--muted);
}
.year-col.is-current .year-label {
  color: var(--ink);
  font-weight: 700;
  position: relative;
  align-self: center;
}
.year-col.is-current .year-label::after {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -4px;
  height: 2px;
  background: var(--blush);
}
.year-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 12px;
}
.year-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.year-legend i {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
}
@media (max-width: 600px) {
  .budget-cats {
    margin-left: 0;
  }
  .budget-cat {
    grid-template-columns: minmax(0, 1fr) auto 86px;
    gap: 10px;
    font-size: 12px;
  }
  .year-chart {
    gap: 2px;
    height: 220px;
  }
  .year-num {
    font-size: 9px;
  }
  .year-cur {
    display: none;
  }
  .year-bars {
    gap: 1px;
  }
  .year-label {
    font-size: 10px;
  }
}
.delete-move {
  margin-top: 14px;
}
.delete-move > label,
.delete-move > div {
  grid-column: 1 / -1;
}
.amt-short {
  display: none;
}
/* Rounded amounts whenever the table is narrow, e.g. half width on a tablet. */
.expected-wrap {
  container-type: inline-size;
}
@container (max-width: 480px) {
  .expected-table .amt-full {
    display: none;
  }
  .expected-table .amt-short {
    display: inline;
  }
  .expected-table th,
  .expected-table td {
    padding-inline: 6px;
  }
}
/* Wide breakdowns use the full panel width with evenly spaced legend columns. */
.donut-wrap {
  container-type: inline-size;
}
@container (min-width: 780px) {
  .donut-layout {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 40px;
  }
  .donut {
    width: 240px;
    height: 240px;
  }
  .donut > div {
    width: 168px;
    height: 168px;
  }
  .donut b {
    font-size: 18px;
  }
  /* Two columns on smaller screens, three on wide ones, each about 240px so names stay near amounts. */
  .chart-legend {
    flex: 0 1 520px;
    columns: 2;
    column-gap: 32px;
    min-width: 0;
    max-width: none;
  }
  .chart-legend li {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    break-inside: avoid;
    margin: 0;
    padding: 8px 12px 8px 0;
    font-size: 13px;
  }
  .chart-legend b {
    text-align: right;
  }
}
.record-date {
  display: block;
  margin-top: 3px;
  padding-left: 1px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
/* Column captions for Group budgets, styled like table headers. */
.budget-head {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.budget-head span,
.budget-cat-head span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.budget-cat-head {
  border-top: 0;
  padding: 0 0 2px;
}
.budget-cat-head span:not(:first-child) {
  text-align: right;
}
/* Line the Budget caption up with the amount inside the button below it. */
.budget-cat-head span:last-child,
.budget-cat-plan {
  text-align: center;
}
button.budget-input {
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}
@media (hover: hover) {
  button.budget-input:hover {
    border-color: var(--ink);
  }
}
/* The budget dialog's amount field only needs room for a money amount. */
#month-budget-form input[name='amount'] {
  max-width: 120px;
  -moz-appearance: textfield;
  appearance: textfield;
}
#month-budget-form input[name='amount']::-webkit-inner-spin-button,
#month-budget-form input[name='amount']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Year chart: month details on hover, keyboard focus or tap. */
.year-col {
  position: relative;
  outline: none;
}
.year-col:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.year-tip {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: none;
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 2px 3px 0 var(--ink);
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}
.year-tip.from-left {
  left: 0;
  transform: none;
}
.year-tip.from-right {
  left: auto;
  right: 0;
  transform: none;
}
.year-col:hover .year-tip,
.year-col:focus .year-tip {
  display: block;
}
.year-tip > b {
  display: block;
  margin-bottom: 4px;
}
.year-tip > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}
.year-tip > span b {
  margin-left: auto;
  color: var(--ink);
  font-weight: 600;
}
.year-tip i {
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
}
.year-tip-net {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* The full lime date band is the payment button, including its padding. */
.day-heading.payday-band {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.payday-band .calendar-paydays {
  flex: 1;
}
.payday-band:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Compact type labels in the transaction journal. */
td .transaction-type-badge,
.schedule-record .transaction-type-badge {
  display: block;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.transaction-type-badge.type-income {
  background: #d8f3de;
  color: #2f7d4c;
}
.transaction-type-badge.type-expense {
  background: #fbdce6;
  color: #b23a66;
}
.transaction-type-badge.type-transfer {
  background: #d8ecfb;
  color: #2a6ca8;
}

.schedule-record .record-amount .transaction-type-badge {
  margin-left: auto;
}

/* Paid occurrences remain readable and editable, matching the calendar. */
.schedule-record.is-paid > .row-link {
  color: var(--muted);
}
.schedule-record.is-paid .record-name,
.schedule-record.is-paid .record-amount {
  color: var(--muted);
  text-decoration: none;
}

/* Setup: compact preferences, collapsible category groups, short account list. */
.preferences-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}
.preferences-row > label {
  flex: 1 1 200px;
}
.preferences-row > label[hidden] {
  display: none;
}
.preferences-row .preferences-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  height: 46px;
  margin: 0;
}
.setup-groups {
  margin-top: 18px;
}
.setup-group {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.setup-group:last-child {
  border-bottom: 0;
}
.setup-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 14px;
  margin: 0;
}
.setup-toggle {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 150px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.setup-group.is-open .budget-chevron {
  transform: rotate(90deg);
}
.setup-group-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-group-head > .textbtn,
.setup-category > .textbtn,
.setup-account > .textbtn {
  justify-self: end;
}
.setup-group-total {
  padding-right: 11px;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}
.setup-categories {
  padding: 0 0 12px 26px;
}
.setup-group .setup-category,
.setup-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 48px;
  align-items: center;
  gap: 14px;
  padding: 2px 0;
  border-bottom: 0;
}
.setup-cat-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-cat-name small {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}
.setup-category.is-hidden .setup-cat-name {
  color: var(--muted);
}
.setup-category .budget-value,
.setup-category #active-budget-input {
  text-align: right;
  min-height: 34px;
  padding: 6px 10px;
}
.setup-category #active-budget-input {
  width: 100%;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
}
.setup-add {
  margin-top: 8px;
}
.setup-account {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.setup-account > b {
  text-align: right;
  padding-right: 11px;
}
.setup-account-head {
  padding: 0 0 6px;
  border-top: 0;
}
.setup-account-head span {
  text-align: right;
  padding-right: 11px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.setup-account .setup-cat-name small {
  display: block;
  margin: 2px 0 0;
}
@media (max-width: 600px) {
  .setup-toggle {
    grid-template-columns: 16px minmax(0, 1fr) 110px;
  }
  .setup-group .setup-category,
  .setup-account {
    grid-template-columns: minmax(0, 1fr) 110px 40px;
    gap: 8px;
  }
  .setup-group-head {
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 8px;
  }
  .setup-categories {
    padding-left: 0;
  }
  .setup-group-name {
    font-size: 15px;
  }
  .setup-cat-name {
    font-size: 13px;
  }
}
/* When Spending breakdown is stretched to match its neighbour, centre the chart and legend vertically. */
.panel:has(> .donut-wrap) {
  display: flex;
  flex-direction: column;
}
.panel > .donut-wrap {
  margin-top: auto;
}
.panel > .donut-wrap:last-child,
.panel > .donut-wrap + .breakdown-actions {
  margin-bottom: auto;
}
/* Side by side in a half-width panel: keep names close to their amounts and centre chart and legend. */
@container (min-width: 480px) and (max-width: 779px) {
  .donut-layout {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 36px;
  }
  .donut {
    width: 230px;
    height: 230px;
  }
  .donut > div {
    width: 160px;
    height: 160px;
  }
  .donut b {
    font-size: 18px;
  }
  .chart-legend {
    flex: 0 1 250px;
  }
  .chart-legend li {
    margin: 13px 0;
    font-size: 13px;
  }
}
.expected-table td.is-worse {
  color: var(--terracotta);
}
/* Spending breakdown tooltip: same card as Income vs Expenses, placed by script. */
.donut-wrap {
  position: relative;
}
.spend-tip {
  display: block;
  left: 0;
  transform: none;
}
.spend-tip[hidden] {
  display: none;
}
.spend-tip > b {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}
.spend-tip > small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
}
.donut[data-stops] {
  cursor: pointer;
}
#spending-legend [data-seg] {
  cursor: default;
  border-radius: 6px;
  outline: none;
}
#spending-legend [data-seg].is-active,
#spending-legend [data-seg]:focus-visible {
  background: var(--line);
  box-shadow: 0 0 0 4px var(--line);
}
/* The yearly list is long: beside it, a larger chart and tighter rows keep the two in proportion. */
@container (min-width: 480px) and (max-width: 779px) {
  .donut-wrap.is-long .donut {
    width: 260px;
    height: 260px;
  }
  .donut-wrap.is-long .donut > div {
    width: 182px;
    height: 182px;
  }
  .donut-wrap.is-long .chart-legend li {
    margin: 8px 0;
  }
}
@container (min-width: 1060px) {
  .chart-legend {
    flex-basis: 780px;
    columns: 3;
  }
}
/* Narrow panels stack the chart above the list; centre the chart. */
@container (max-width: 479px) {
  .donut-layout {
    justify-content: center;
  }
}
/* Goal cards reuse the debt card layout and its vertical rhythm. */
.goal-grid > .panel > .panel-head {
  align-items: flex-start;
  margin-bottom: 12px;
}
/* Without a badge the title line is shorter, so Edit moves up a little more to stay centred. */
.goal-grid > .panel > .panel-head > .textbtn {
  margin: -7px 0 0;
  padding-right: 0;
}
.goal-grid .debt-card-summary .large-value {
  margin: 0 0 6px;
}
.goal-grid .debt-card-summary p {
  margin-top: 0;
}
.goal-grid .goal-status {
  display: inline-block;
  margin-left: 10px;
  vertical-align: 3px;
}
.goal-status.is-muted {
  background: #eeede8;
  color: var(--muted);
}
.goal-grid .debt-card-footer {
  flex-wrap: wrap;
  row-gap: 4px;
  align-items: center;
  margin-top: auto;
  padding-top: 2px;
}
.goal-grid .meter {
  margin: 14px 0 0;
}
.goal-links {
  display: flex;
  gap: 14px;
}
.goal-links {
  margin-left: auto;
}
.goal-links .textbtn,
.goal-grid .debt-card-footer > span:first-child {
  padding-right: 0;
  white-space: nowrap;
}
/* When the footer wraps on a phone, keep the amount clear of the progress bar. */
.goal-grid .debt-card-footer > span:first-child {
  padding-block: 8px;
}
/* Narrow goal cards (two per row on mid-size screens, or a phone): buttons go under the amount. */
.goal-grid > .panel {
  container-type: inline-size;
}
.goal-grid .large-value {
  white-space: nowrap;
}
@container (max-width: 479px) {
  .goal-grid .debt-card-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .goal-grid .debt-card-actions {
    justify-content: stretch;
  }
  .goal-grid .debt-card-actions .btn {
    flex: 1 1 0;
  }
}
/* Goal history opens inside the card like the debt schedule; the other card in the row keeps its height. */
.goal-grid {
  align-items: start;
}
.goal-history .flow-in {
  color: var(--ink);
}
.goal-history .flow-out {
  color: var(--ink);
}
.goal-history .table-link {
  text-align: left;
}
.goal-history-empty {
  margin: 16px 0 0;
}
/* Narrow goal cards: tighter history cells so all four columns fit without scrolling. */
@container (max-width: 479px) {
  .goal-history th,
  .goal-history td {
    padding: 11px 4px;
    font-size: 13px;
  }
  .goal-history th:first-child,
  .goal-history td:first-child {
    padding-left: 0;
  }
  .goal-history th:last-child,
  .goal-history td:last-child {
    padding-right: 0;
    text-align: right;
  }
}
.journal-date {
  white-space: nowrap;
}

#toast.has-action {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}
#toast button {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

/* Status pills only for Due today (yellow) and Overdue (pink), as in the Bill Calendar. */
.status-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}
.record-amount small .status-pill {
  margin-top: 4px;
}
.status-pill.status-due-today {
  background: #fcefc0;
  color: #8a6d12;
}
.status-pill.status-overdue {
  background: #fbdce6;
  color: #b23a66;
}

/* Pencil Edit button: centred on the card title line, smaller in the compact Setup rows. */
.edit-icon {
  flex-shrink: 0;
  min-width: 36px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
}
.panel-head > .edit-icon {
  margin-top: -3px;
}
.setup-group-head > .edit-icon,
.setup-category > .edit-icon,
.setup-account > .edit-icon {
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 15px;
}

/* Debt cards two per row like accounts and goals; one column below 800px.
   An open schedule grows only its own card. */
.debt-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}
.debt-list > .panel {
  margin: 0;
  container-type: inline-size;
}
.debt-list > .panel:only-child {
  grid-column: 1 / -1;
}
@media (max-width: 800px) {
  .debt-list {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container (max-width: 560px) {
  .debt-list .debt-card-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .debt-list .debt-card-actions .btn {
    flex: 1 1 0;
  }
  .debt-list .debt-schedule th,
  .debt-list .debt-schedule td {
    padding: 11px 4px;
    font-size: 13px;
  }
}

/* Clicking anywhere on a payment row (except the check box) opens the payment;
   the whole row lights up on hover. */
.payment-row {
  position: relative;
}
.payment-row > .row-link::after {
  content: '';
  position: absolute;
  inset: 0;
}
@media (hover: hover) {
  .payment-row > .row-link:hover {
    background: none;
  }
}
@media (hover: hover) {
  .payment-row:hover {
    background: #fafaf7;
  }
}
.payment-row > .pay-check {
  position: relative;
  z-index: 1;
}

/* Recurring templates: one list, next date and amount columns, a square pause button. */
.template-next {
  flex: 0 0 110px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
}
.template-next small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.template-row.is-paused .template-next {
  color: var(--muted);
}
.template-row > .record-amount {
  text-align: right;
}
.template-toggle svg {
  fill: var(--ink);
}
.template-row.is-paused .record-name,
.template-row.is-paused .record-amount {
  color: var(--muted);
}
@media (max-width: 700px) {
  /* On a phone the date sits under the amount, so the name keeps its width. */
  .schedule-record.template-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 24px;
    grid-template-areas: 'name amount toggle' 'name next toggle';
    column-gap: 10px;
    align-items: center;
  }
  .template-row > .row-link {
    grid-area: name;
  }
  .template-row > .record-amount {
    grid-area: amount;
    align-self: end;
    padding: 12px 0 0;
  }
  .template-next {
    grid-area: next;
    align-self: start;
    padding-bottom: 12px;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
  }
  .template-next small {
    display: inline;
  }
  .template-next small::before {
    content: ' · ';
  }
  .template-row > .template-toggle {
    grid-area: toggle;
  }
}

/* Phones: Month / Year, Payment Schedule / Recurring and the Setup switch fill the screen width,
   each pill taking an equal half. */
@media (max-width: 600px) {
  .screen-switch {
    display: flex;
    width: 100%;
  }
  .screen-switch .switch-pill {
    flex: 1 1 0;
  }
}

/* Phones: the lime Add button sits at the right of the title row on every screen, and the month
   (or year) picker spans the full width below. Dashboard hides Add transaction; it is added from
   the Transactions screen. */
@media (max-width: 600px) {
  .budget-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px 12px;
  }
  .heading-actions {
    display: contents;
  }
  .heading-actions > .btn.primary {
    grid-column: 2;
    grid-row: 1;
    padding-inline: 14px;
    white-space: nowrap;
  }
  .dashboard-view .heading-actions > .btn.primary {
    display: none;
  }
  .heading-actions > .mp-picker,
  .heading-actions > .year-picker {
    grid-column: 1/-1;
    display: flex;
    width: 100%;
  }
  .heading-actions .mp-trigger {
    flex: 1 1 auto;
    justify-content: center;
  }
}
/* Narrowest phones: a slightly smaller Add button keeps clear of long titles like Transactions. */
@media (max-width: 360px) {
  .heading-actions > .btn.primary {
    font-size: 13px;
    padding-inline: 11px;
  }
}

/* Bill Calendar list view: a quiet day heading, then Payment Schedule rows. */
.cal-list-day {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}
.panel-head + .cal-list-day {
  margin-top: 0;
}
.cal-list-day small {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

/* Transactions on phones: rows instead of the table. Name and amount on one line; the type badge
   (fixed width, so the details line up) with date, category and account below. */
.tx-list {
  display: none;
}
@media (max-width: 600px) {
  .panel:has(> .tx-list) > .table-wrap {
    display: none;
  }
  .tx-list {
    display: block;
    margin-top: 8px;
  }
  .tx-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 10px;
    width: 100%;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: none;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }
  .tx-name,
  .tx-amount {
    font-size: 14px;
    font-weight: 700;
  }
  .tx-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tx-meta {
    grid-column: 1/-1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12px;
    color: var(--muted);
  }
  .tx-meta > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .tx-meta .transaction-type-badge {
    flex: 0 0 66px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
    padding: 3px 0;
    text-align: center;
  }
}

/* Phones: the edit window's buttons stay pinned to its bottom edge while the form scrolls. */
@media (max-width: 600px) {
  #editor {
    --editor-pad: 16px;
  }
  #editor .dialog-actions {
    flex-wrap: nowrap;
    gap: 8px;
    position: sticky;
    bottom: calc(-1 * var(--editor-pad, 26px));
    z-index: 2;
    margin: 20px calc(-1 * var(--editor-pad, 26px)) calc(-1 * var(--editor-pad, 26px));
    padding: 14px var(--editor-pad, 26px) var(--editor-pad, 26px);
    background: var(--bg);
  }
}

/* Old address only: where the app has moved and the one-click move. */
.move-notice {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card, #fff);
  box-shadow: 2px 3px 0 var(--ink);
}
.move-notice p {
  margin: 6px 0 12px;
  font-size: 14px;
}
