.bills-page {
  display: grid;
  width: min(1080px, calc(100% - 32px));
  min-height: calc(100svh - 140px);
  align-content: start;
  gap: 16px;
  margin: 0 auto;
  padding: 32px 0 72px;
}

.bills-heading,
.bills-heading > div,
.bill-section-heading {
  display: flex;
  align-items: center;
}

.bills-heading { justify-content: space-between; gap: 18px; }
.bills-heading > div { gap: 12px; }
.bills-heading h1 { font: 600 clamp(1.8rem, 4vw, 2.7rem)/1 "Newsreader", serif; letter-spacing: -.03em; }
.bills-heading time { color: var(--muted); font-size: .78rem; font-weight: 800; }
.bills-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: #ead39a; font-size: 1.25rem; }

.bills-lock {
  display: grid;
  width: min(460px, 100%);
  justify-self: center;
  gap: 15px;
  margin-top: clamp(28px, 8vh, 90px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: clamp(22px, 5vw, 34px);
  text-align: center;
}
.bills-lock[hidden], .bills-private-dashboard[hidden] { display: none; }
.bills-lock > span { font-size: 2rem; }
.bills-lock h2 { margin: 0; font-size: clamp(1.2rem, 3vw, 1.55rem); }
.bills-lock form { display: grid; gap: 8px; text-align: left; }
.bills-lock label { color: var(--muted); font-size: .72rem; font-weight: 800; }
.bills-lock form div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.bills-lock input,
.bills-lock button { min-height: 46px; border: 1px solid var(--line); border-radius: 11px; font: inherit; }
.bills-lock input { min-width: 0; background: var(--bg); color: var(--ink); padding: 0 13px; }
.bills-lock button { background: var(--ink); color: var(--bg); padding: 0 18px; font-weight: 850; cursor: pointer; }
.bills-lock button:disabled { cursor: wait; opacity: .6; }
.bills-lock p { min-height: 1.2em; margin: 0; color: var(--muted); font-size: .76rem; }
.bills-private-dashboard { display: grid; gap: 16px; }

.bill-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bill-totals article { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 17px 18px; }
.bill-totals span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.bill-totals strong { font: 600 clamp(1.65rem, 4vw, 2.35rem)/1 "Newsreader", serif; }

.income-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.income-facts article { display: grid; gap: 4px; min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.income-facts span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.income-facts strong { font-size: 1rem; font-variant-numeric: tabular-nums; }

.bill-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); padding: clamp(17px, 3vw, 24px); }
.bill-section-heading { justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.bill-section-heading h2 { margin: 0; font-size: clamp(1.03rem, 2vw, 1.3rem); }
.bill-section-heading > strong { font-size: .95rem; }
.locked-chip { border-radius: 999px; background: color-mix(in srgb, var(--surface) 65%, #ead39a); padding: 6px 9px; color: var(--muted); font-size: .66rem; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }

.bill-table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; white-space: nowrap; }
thead th { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; }
tbody th { font-weight: 750; }
.daily-cost-row td,
.daily-cost-row th { background: color-mix(in srgb, var(--surface) 78%, #ead39a); }
td:nth-child(3), thead th:nth-child(3), tfoot td { text-align: right; font-variant-numeric: tabular-nums; }
tfoot th, tfoot td { border-bottom: 0; padding-top: 16px; font-weight: 900; }
tfoot tr + tr th,
tfoot tr + tr td { border-top: 1px solid var(--line); }

.savings-panel { display: grid; gap: 15px; }
.savings-panel .bill-section-heading { margin-bottom: 0; }
.savings-progress-copy { display: flex; align-items: baseline; gap: 8px; }
.savings-progress-copy strong { font: 600 clamp(2rem, 6vw, 3.3rem)/1 "Newsreader", serif; }
.savings-progress-copy span { color: var(--muted); font-weight: 800; }
.savings-panel progress { width: 100%; height: 16px; border: 0; border-radius: 999px; overflow: hidden; accent-color: #7f9e75; }
.savings-panel progress::-webkit-progress-bar { border-radius: 999px; background: color-mix(in srgb, var(--surface) 70%, #d9dfd5); }
.savings-panel progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, #d4ad55, #6f946b); }
.savings-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.savings-facts article { display: grid; gap: 4px; min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 13px; }
.savings-facts span { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.savings-facts strong { overflow: hidden; font-size: .95rem; text-overflow: ellipsis; }
.savings-note { margin: -2px 0 0; color: var(--muted); font-size: .72rem; }

.bill-editor { padding: 0; }
.bill-editor > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 19px 22px; cursor: pointer; list-style: none; }
.bill-editor > summary::-webkit-details-marker { display: none; }
.bill-editor > summary::after { content: "+"; font-size: 1.25rem; font-weight: 900; }
.bill-editor[open] > summary::after { content: "−"; }
.bill-editor > summary span { margin-left: auto; color: var(--muted); font-size: .72rem; font-weight: 800; }
.bill-editor-form { display: grid; gap: 18px; border-top: 1px solid var(--line); padding: 20px 22px 22px; }
.bill-editor-group { display: grid; min-width: 0; gap: 10px; margin: 0; border: 0; padding: 0; }
.bill-editor-group legend { margin-bottom: 9px; padding: 0; font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.bill-editor-grid,
.bill-editor-rows { display: grid; min-width: 0; gap: 8px; }
.bill-editor-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bill-editor-row { display: grid; min-width: 0; gap: 8px; }
.bill-editor-row.monthly-row { grid-template-columns: minmax(80px, .45fr) minmax(170px, 1.5fr) minmax(120px, .55fr); }
.bill-editor-row.daily-row { grid-template-columns: minmax(0, 1fr) minmax(150px, .5fr); }
.bill-editor-field { display: grid; min-width: 0; gap: 5px; color: var(--muted); font-size: .68rem; font-weight: 800; }
.bill-editor-field input { width: 100%; min-width: 0; min-height: 43px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); padding: 0 11px; font: 700 .85rem "DM Sans", sans-serif; }
.bill-editor-field input:focus { outline: 2px solid color-mix(in srgb, #d4ad55 70%, transparent); outline-offset: 1px; }
.bill-editor-actions { display: flex; align-items: center; gap: 12px; }
.bill-editor-actions button { min-height: 44px; border: 1px solid var(--ink); border-radius: 11px; background: var(--ink); color: var(--bg); padding: 0 18px; font: 850 .82rem "DM Sans", sans-serif; cursor: pointer; }
.bill-editor-actions button:disabled { cursor: wait; opacity: .6; }
.bill-editor-actions span { color: var(--muted); font-size: .75rem; font-weight: 800; }

:root[data-theme="dark"] .bills-icon { background: #62542c; color: #f4e6ab; }

@media (max-width: 900px) {
  .bill-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .income-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .bill-totals { grid-template-columns: 1fr; }
  .bill-totals article { grid-template-columns: 1fr auto; align-items: center; }
  .bill-totals article strong { font-size: 1.75rem; }
  .savings-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .bills-page { width: min(100% - 20px, 1080px); padding-top: 22px; }
  .bills-heading { align-items: flex-start; }
  .bills-heading time { padding-top: 8px; text-align: right; }
  .bill-schedule-panel { padding-inline: 12px; }
  table { min-width: 440px; }
  .savings-facts,
  .income-facts,
  .bill-editor-grid.two-columns,
  .bill-editor-row.monthly-row,
  .bill-editor-row.daily-row { grid-template-columns: 1fr; }
  .bill-editor > summary span { display: none; }
  .bill-editor-form { padding-inline: 14px; }
}

/* Universal button-border contract: every enabled button renders a visible 1px border. */
button:not(:disabled) {
  border-style: solid !important;
  border-width: 1px !important;
}
