:root {
  color-scheme: light;
  --ink: #17352d;
  --muted: #70817b;
  --line: #e4ebe7;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --deep: #102b25;
  --green: #1f7657;
  --green-soft: #e7f4ed;
  --amber: #946b18;
  --amber-soft: #fff4d9;
  --red: #a44b43;
  --red-soft: #fff0ee;
  --shadow: 0 10px 30px rgba(23, 53, 45, .055);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 850px; min-height: 100vh; margin: 0 auto; background: var(--canvas); }
.topbar { min-height: 88px; padding: max(18px, env(safe-area-inset-top)) 22px 18px; background: var(--deep); color: white; display:flex; align-items:center; justify-content:space-between; gap:14px; }
.brand-lockup { display:flex; align-items:center; gap:12px; }
.brand-mark { width:44px; height:44px; display:grid; place-items:center; background:#d5eadf; color:var(--deep); font-weight:850; font-size:13px; letter-spacing:-.5px; border-radius:15px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.brand-eyebrow { color:#9fc6b5; font-size:9px; font-weight:800; letter-spacing:.17em; margin-bottom:3px; }
h1 { font-size:21px; letter-spacing:-.035em; line-height:1.05; margin:0; font-weight:760; }
.connection-pill { display:flex; align-items:center; gap:7px; padding:7px 10px; font-size:11px; color:#d9e9e2; border:1px solid rgba(255,255,255,.18); border-radius:30px; white-space:nowrap; }
.status-dot { width:7px; height:7px; display:inline-block; border-radius:50%; background:#86d7a8; box-shadow:0 0 0 3px rgba(134,215,168,.12); }
main { padding:20px 18px 30px; }
.month-panel { background:linear-gradient(125deg,#173d32,#225643); color:white; padding:20px; border-radius:23px; box-shadow:var(--shadow); }
.month-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:12px; }
.eyebrow { margin:0 0 6px; color:#a7c8b9; letter-spacing:.14em; font-weight:800; font-size:9px; }
.month-heading h2 { margin:0; color:white; font-size:27px; letter-spacing:-.045em; }
.month-select-wrap select { max-width:155px; color:white; background:#ffffff18; border:1px solid #ffffff3b; border-radius:10px; padding:9px 29px 9px 10px; outline:none; }
.month-select-wrap option { color:var(--ink); }
.month-actions { display:flex; align-items:flex-end; justify-content:space-between; gap:10px; margin-top:19px; padding-top:16px; border-top:1px solid #ffffff25; }
.month-input-wrap { display:flex; flex-direction:column; gap:5px; min-width:0; }
.month-input-wrap label { color:#c2d8cf; font-size:10px; }
.month-input-wrap input { width:165px; padding:8px 10px; border:1px solid #ffffff38; color:white; background:#ffffff12; border-radius:9px; color-scheme:dark; }
.button { border:0; display:inline-flex; align-items:center; justify-content:center; gap:7px; border-radius:11px; min-height:42px; padding:0 15px; font-weight:720; font-size:12px; transition:transform .14s ease, opacity .14s ease; }
.button:active { transform:scale(.98); }
.button-primary { background:#d9eee3; color:#173d32; }
.button-secondary { background:#edf3ef; color:#234638; border:1px solid #dfebe3; }
.summary-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; margin-top:14px; }
.summary-card { min-width:0; border:1px solid var(--line); background:var(--surface); padding:15px 15px 13px; border-radius:17px; box-shadow:var(--shadow); }
.summary-total { grid-column:1 / -1; background:#fff; }
.summary-label { color:var(--muted); font-size:11px; font-weight:650; }
.summary-value { margin-top:5px; font-size:clamp(20px,5vw,26px); letter-spacing:-.045em; font-weight:790; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.summary-total .summary-value { font-size:29px; }
.summary-due .summary-value { color:var(--red); }
.summary-paid .summary-value { color:var(--green); }
.summary-foot { color:#8b9a94; font-size:10px; margin-top:4px; }
.progress-panel { background:white; border:1px solid var(--line); padding:15px; border-radius:16px; margin-top:12px; }
.progress-meta { display:flex; justify-content:space-between; gap:10px; font-size:11px; margin-bottom:10px; }
.progress-meta strong { font-weight:750; }
.progress-meta span { color:var(--muted); font-variant-numeric:tabular-nums; }
.progress-track { height:9px; border-radius:20px; background:#edf2ef; overflow:hidden; }
.progress-fill { width:0; height:100%; border-radius:20px; background:linear-gradient(90deg,#368b68,#77bd91); transition:width .25s ease; }
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:27px 1px 13px; }
.toolbar h3,.bottom-tools h3 { margin:0; font-size:17px; letter-spacing:-.025em; }
.toolbar p,.bottom-tools-heading p { margin:4px 0 0; font-size:11px; color:var(--muted); }
.toolbar .button { flex-shrink:0; }
.filter-tabs { display:flex; gap:7px; margin-bottom:10px; overflow-x:auto; padding-bottom:2px; }
.filter-tab { background:transparent; border:1px solid transparent; color:#71827b; border-radius:30px; padding:8px 12px; font-size:11px; font-weight:700; white-space:nowrap; }
.filter-tab span { margin-left:4px; padding:2px 6px; border-radius:30px; background:#e8efeb; color:#577066; font-size:10px; }
.filter-tab.active { color:#1a513e; background:#e7f3ec; border-color:#d3e9dc; }
.filter-tab.active span { background:#d1e9da; color:#1b6548; }
.bill-list { display:flex; flex-direction:column; gap:8px; }
.bill-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; background:var(--surface); border:1px solid var(--line); border-radius:15px; padding:13px 13px 12px; box-shadow:0 3px 12px rgba(23,53,45,.025); }
.bill-main { min-width:0; }
.bill-title-row { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.bill-name { font-size:13px; font-weight:740; overflow-wrap:anywhere; }
.bill-card.is-paid .bill-name { color:#89958f; text-decoration:line-through; text-decoration-thickness:1.4px; }
.bill-kind { display:inline-flex; align-items:center; border-radius:30px; padding:3px 7px; font-size:9px; font-weight:760; letter-spacing:.015em; }
.bill-kind.fixed { color:#60746a; background:#edf2ef; }
.bill-kind.variable { color:var(--amber); background:var(--amber-soft); }
.bill-meta { display:flex; align-items:center; gap:7px; margin-top:6px; color:#89968f; font-size:10px; }
.bill-meta .paid-date { color:var(--green); }
.bill-right { display:flex; align-items:flex-end; flex-direction:column; gap:7px; }
.bill-amount { width:110px; text-align:right; font-size:14px; font-weight:790; color:var(--ink); font-variant-numeric:tabular-nums; border:1px solid transparent; border-radius:8px; padding:5px 6px; background:transparent; outline:none; }
.bill-amount.editable { width:117px; background:#fff9e8; border-color:#f0dfb3; color:#6f5014; }
.bill-amount:focus { border-color:#b68a34; box-shadow:0 0 0 3px #e9cf8c55; }
.status-button { display:flex; align-items:center; gap:6px; border:1px solid #f0d9d5; background:var(--red-soft); color:#99534d; min-height:29px; padding:0 9px; border-radius:8px; font-size:10px; font-weight:760; }
.status-button.paid { background:var(--green-soft); color:#26704f; border-color:#cfe7d8; }
.status-button .check { font-size:12px; font-weight:900; }
.bottom-tools { margin-top:25px; background:white; border:1px solid var(--line); border-radius:18px; padding:16px; }
.tools-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:13px; }
.tool-button { display:flex; align-items:center; gap:10px; min-width:0; text-align:left; border:1px solid #e8eeea; background:#fbfcfb; border-radius:12px; padding:11px 9px; color:var(--ink); }
.tool-button:active { background:#eff6f1; }
.tool-icon { width:31px; height:31px; flex:0 0 31px; border-radius:9px; background:#e9f3ed; color:#28684d; display:grid; place-items:center; font-size:17px; font-weight:800; }
.tool-button strong { display:block; font-size:10px; }
.tool-button small { display:block; color:#87948d; font-size:9px; margin-top:3px; }
.app-footer { padding:18px 5px 7px; text-align:center; font-size:10px; color:#9aa6a0; }
.app-dialog { width:min(440px,calc(100% - 28px)); border:0; border-radius:20px; padding:20px; color:var(--ink); box-shadow:0 24px 80px #0b211a45; }
.app-dialog::backdrop { background:#0d211b80; backdrop-filter:blur(3px); }
.dialog-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:17px; }
.dialog-heading .eyebrow { color:#779386; }
.dialog-heading h2 { margin:0; font-size:22px; letter-spacing:-.04em; }
.icon-button { width:32px; height:32px; border:0; border-radius:50%; background:#f0f4f1; color:#486057; font-size:22px; line-height:1; }
.field-label { display:block; margin:13px 0 6px; font-size:11px; font-weight:750; }
.text-field { width:100%; min-height:45px; padding:10px 12px; border:1px solid #dce7e0; border-radius:10px; background:white; color:var(--ink); outline:none; }
.text-field:focus { border-color:#6eae8b; box-shadow:0 0 0 3px #b9e0c866; }
.dialog-note { margin-top:13px; padding:11px; border-radius:10px; background:#f2f6f3; color:#697d73; font-size:10px; line-height:1.55; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.help-content { display:flex; flex-direction:column; gap:15px; }
.help-row { display:flex; align-items:flex-start; gap:10px; }
.help-row strong { font-size:12px; }
.help-row p { margin:3px 0 0; color:var(--muted); font-size:11px; line-height:1.5; }
.legend-dot { width:10px; height:10px; border-radius:50%; flex:0 0 10px; margin-top:3px; }
.fixed-dot { background:#9aaa9f; }.variable-dot { background:#d2a33d; }.paid-dot { background:#4b9c70; }
.toast { position:fixed; z-index:10; left:50%; bottom:calc(18px + env(safe-area-inset-bottom)); transform:translate(-50%,20px); opacity:0; pointer-events:none; padding:11px 16px; border-radius:30px; color:white; background:#173b30; box-shadow:0 8px 25px #122b2240; font-size:12px; font-weight:650; transition:all .2s ease; max-width:calc(100% - 32px); text-align:center; }
.toast.show { opacity:1; transform:translate(-50%,0); }
.empty-state { padding:24px 14px; text-align:center; background:white; border:1px dashed #d9e4dd; border-radius:14px; color:var(--muted); font-size:12px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (min-width:650px) { main { padding:24px 26px 35px; }.summary-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }.summary-total { grid-column:auto; }.summary-value,.summary-total .summary-value { font-size:23px; }.bill-card { padding:14px 16px; }.topbar { padding-left:28px; padding-right:28px; } }
@media (max-width:390px) { main { padding-left:12px; padding-right:12px; }.topbar { padding-left:15px; padding-right:15px; }.month-panel { padding:16px; }.month-heading h2 { font-size:24px; }.month-select-wrap select { max-width:126px; }.toolbar { align-items:flex-start; }.toolbar .button { padding:0 10px; }.bill-card { padding:11px 9px; gap:6px; }.bill-amount { width:100px; }.bill-amount.editable { width:105px; }.bill-name { font-size:12px; } }

.reminder-banner { margin-top:11px; padding:11px 13px; border-radius:12px; color:#855c12; background:#fff4da; border:1px solid #f0dfb1; font-size:11px; line-height:1.5; }
.reminder-banner[hidden] { display:none; }
.bill-date-row { display:flex; align-items:center; gap:6px; margin-top:6px; color:#91a098; font-size:9px; }
.bill-date-row input { max-width:130px; min-width:0; padding:3px 5px; border:1px solid #e7ece8; background:#fbfcfb; border-radius:6px; color:#63766c; font:inherit; font-size:9px; }
.bill-date-row input:focus { outline:2px solid #c5e2d1; border-color:#a9cfb8; }
.history-panel { margin-top:18px; background:#fff; border:1px solid var(--line); border-radius:17px; padding:15px; }
.history-list { display:flex; flex-direction:column; gap:7px; margin-top:12px; }
.history-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:center; padding:10px 11px; border:1px solid #ebf0ec; border-radius:11px; background:#fbfcfb; text-align:left; color:var(--ink); width:100%; }
.history-item.current { border-color:#bcd9c8; background:#f1f8f3; }
.history-month-name { font-size:11px; font-weight:750; }
.history-month-meta { margin-top:3px; color:#87948d; font-size:9px; }
.history-total { text-align:right; font-size:12px; font-weight:800; font-variant-numeric:tabular-nums; }
.history-due { display:block; margin-top:3px; color:#a35a51; font-size:9px; font-weight:600; }

/* Recurring bill management additions */
.toolbar-actions { display:flex; align-items:center; gap:7px; flex-shrink:0; }
.toolbar-actions .button { padding:0 10px; font-size:11px; }
.wide-dialog { width:min(560px,calc(100% - 24px)); max-height:88vh; overflow:auto; }
.manage-intro { margin:-7px 0 13px; color:var(--muted); font-size:11px; line-height:1.55; }
.manage-list { display:flex; flex-direction:column; gap:7px; max-height:38vh; overflow:auto; padding:1px; }
.manage-row { display:flex; align-items:center; justify-content:space-between; gap:9px; border:1px solid var(--line); border-radius:11px; padding:9px 10px; background:#fbfcfb; }
.manage-row-main { min-width:0; }
.manage-row-name { display:block; font-size:11px; font-weight:750; overflow-wrap:anywhere; }
.manage-row-meta { display:block; margin-top:3px; font-size:9px; color:var(--muted); }
.manage-row-actions { display:flex; gap:5px; flex-shrink:0; }
.small-action { border:1px solid #dfe9e2; background:#fff; color:#315b48; border-radius:8px; min-height:30px; padding:0 8px; font-size:10px; font-weight:700; }
.small-action.danger { color:#99534d; border-color:#f0d9d5; background:#fff8f7; }
.manage-add-row { justify-content:flex-start; margin-top:10px; }
.embedded-form { margin-top:14px; padding:14px; border:1px solid #dce9e0; border-radius:13px; background:#f7faf8; }
.embedded-form[hidden] { display:none; }
.embedded-form h3 { margin:0 0 8px; font-size:15px; }
.custom-actions { display:flex; gap:5px; }
.custom-action { border:0; background:transparent; color:#557266; text-decoration:underline; padding:2px 3px; font-size:9px; font-weight:700; }
.custom-action.remove { color:#a44b43; }
@media (max-width:390px) { .toolbar-actions { gap:5px; }.toolbar-actions .button { min-height:38px; padding:0 7px; font-size:10px; }.manage-row { align-items:flex-start; }.manage-row-actions { flex-direction:column; } }


/* Version 3 recurring-bill lifecycle controls */
.manage-section { margin-top: 12px; }
.manage-section-heading { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin:0 1px 8px; }
.manage-section-heading h3 { margin:0; font-size:13px; letter-spacing:-.02em; }
.manage-section-note { color:var(--muted); font-size:9px; text-align:right; }
.count-pill { display:inline-flex; min-width:19px; height:19px; align-items:center; justify-content:center; margin-left:3px; border-radius:20px; background:#e9f3ed; color:#28684d; font-size:10px; vertical-align:middle; }
.stopped-section { padding-top:13px; border-top:1px solid var(--line); }
.stopped-row { background:#f7f9f8; }
.small-action.danger-outline { color:#9a4f49; border-color:#ead3d0; background:#fff; }
.manage-row-actions { flex-wrap:wrap; justify-content:flex-end; }
@media (max-width:390px) { .manage-row-actions { max-width:104px; flex-direction:row; }.small-action { min-height:29px; padding:0 7px; font-size:9px; } }
