:root { color-scheme: dark; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; letter-spacing: 0; }

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.4; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar-inner { margin: auto; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; flex: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; padding-bottom: 5px; border-radius: 5px; line-height: 1; font-weight: 700; }
.nav-button { min-width: 82px; padding: 3px 14px 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #a2b0ba; font-size: 14px; font-weight: 600; }
.nav-button:hover { color: #fff; }
.nav-button.active { color: #fff; border-bottom-color: var(--cyan); }
.top-actions { display: flex; align-items: center; margin-left: auto; }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid transparent; border-radius: 5px; white-space: nowrap; font-size: 14px; font-weight: 650; transition: background .15s, border-color .15s; }
.button-primary { background: var(--cyan); color: #082532; }
.button-primary:hover { background: #6bd5f2; }
.button-secondary { border-color: #586977; background: #29343d; color: var(--ink); }
.button-secondary:hover { background: #34414b; }

.page-shell { max-width: 1480px; margin: auto; padding: 23px 24px 52px; }
.year-mode .page-shell { max-width: none; padding: 19px 20px 28px; }
.page-heading { display: flex; justify-content: space-between; margin-bottom: 20px; }
.year-mode .page-heading { margin-bottom: 13px; }
.eyebrow { margin: 0 0 4px; color: var(--cyan); font-size: 12px; font-weight: 700; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: 27px; font-weight: 750; line-height: 1.2; }
h2 { margin-bottom: 2px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.muted, .section-heading p { color: var(--muted); }
.page-heading .muted { margin: 0; font-size: 13px; }
.period-picker, .filters label { display: flex; flex-direction: column; gap: 6px; color: #abb9c2; font-size: 13px; font-weight: 600; }
select, input { min-height: 39px; padding: 7px 10px; border: 1px solid #526473; border-radius: 5px; outline: 0; background: #222c35; color: var(--ink); font-size: 14px; }
input::placeholder { color: #8c9da8; }
.period-picker select { min-width: 190px; }

.year-summary { display: grid; }
.year-summary > div { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.year-summary > div:last-child { border-right: 0; }
.year-summary span { color: var(--muted); font-weight: 600; }
.year-summary strong { overflow-wrap: anywhere; font-weight: 740; font-variant-numeric: tabular-nums; }
.year-summary > div:nth-child(1) strong { color: var(--green); }
.year-summary > div:nth-child(2) strong { color: var(--yellow); }
.year-summary > div:nth-child(3) strong { color: var(--orange); }
.year-summary > div:nth-child(4) strong { color: var(--red); }
.year-summary > div.is-clear strong { color: var(--green); }
.year-summary > div:nth-child(5) strong { color: var(--cyan); }
.year-summary small { color: var(--muted); font-size: 11px; text-transform: none; }
.year-summary strong.negative { color: var(--red) !important; }
.year-table-wrap { border: 1px solid #41505b; scrollbar-color: #526674 #1e262d; }
.year-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-variant-numeric: tabular-nums; }
.year-table th, .year-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.year-table thead th { position: sticky; z-index: 3; color: #d8e7ef; text-align: right; font-weight: 700; }
.year-table thead th:nth-child(2), .year-table td.year-subcategory { width: 210px; text-align: left; }
.year-table thead th:nth-child(3) { width: 78px; }
.year-table thead th:nth-child(n+4):nth-child(-n+15) { width: 67px; }
.year-table thead th:nth-child(n+16) { width: 90px; }
.year-table thead th:nth-child(2), .year-table td.year-subcategory { position: sticky; left: 180px; z-index: 2; box-shadow: 2px 0 4px #0b131850; }
.year-table thead th:nth-child(1), .year-table thead th:nth-child(2) { z-index: 5; }
.year-table thead button { width: 100%; display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 0; border: 0; background: transparent; color: inherit; text-align: right; font-size: inherit; font-weight: inherit; }
.year-table thead th:nth-child(-n+2) button { justify-content: flex-start; text-align: left; }
.sort-indicator { color: #82949f; font-size: 10px; }
.year-table thead button:hover .sort-indicator { color: var(--cyan); }
.year-table thead button:hover { color: var(--cyan); }
.year-table thead th.is-current { color: var(--cyan); background: #27404d; }
.year-row td { background: var(--row-bg); text-align: right; }
.year-row td.year-category, .year-row td.year-subcategory { background: var(--row-bg); }
.year-row td.year-category { color: #e9f0f2; font-weight: 600; }
.year-row td.year-subcategory { color: #c3cfd4; }
.year-parent td { --row-bg: #2a3640; font-weight: 700; }
.year-parent.income td { --row-bg: #243a34; }
.year-group-toggle { width: 100%; display: flex; align-items: center; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.year-group-toggle:hover .year-group-name { color: #fff; }
.year-disclosure { display: grid; flex: none; place-items: center; border: 1px solid #52616c; line-height: 1; }
.year-group-icon { flex: none; text-align: center; }
.year-group-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.year-child td.year-subcategory { padding-left: 13px; }
.child-indent { margin-right: 7px; color: #7f929c; }
.year-row td.year-difference { color: var(--green); }
.year-row td.year-difference.negative, .year-row td.negative { color: var(--red); }
.year-row.year-total { --row-bg: #2a3640; }
.year-row.year-total td { font-weight: 740; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.metric { display: flex; flex-direction: column; min-width: 0; min-height: 125px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.metric-accent { border-top: 2px solid var(--cyan); }
.metric-label { color: #adbdc6; font-size: 13px; font-weight: 600; }
.metric-value { margin-top: 10px; overflow-wrap: anywhere; font-size: 26px; font-weight: 740; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric:nth-child(1) .metric-value { color: var(--green); }
.metric:nth-child(2) .metric-value { color: var(--orange); }
.metric:nth-child(3) .metric-value { color: var(--cyan); }
.metric:nth-child(4) .metric-value { color: var(--yellow); }
.metric-value.negative { color: var(--red) !important; }
.metric-detail { margin-top: auto; padding-top: 9px; color: var(--muted); font-size: 12px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-heading p { margin: 0; font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; padding-top: 3px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 2px; }

.category-section { margin-top: 24px; }
.category-heading { align-items: flex-end; margin-bottom: 12px; }
.segmented { display: inline-flex; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: #202830; }
.segment { padding: 6px 11px; border: 0; border-radius: 3px; background: transparent; color: #a6b5bf; font-size: 13px; font-weight: 650; }
.segment.active { background: #254555; color: var(--cyan); }
.empty-inline { margin: 0; color: var(--muted); font-size: 14px; }
.billing-item { min-height: 44px; display: grid; align-items: center; gap: 12px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); font-size: 12px; }
.billing-item strong { color: var(--ink); }
.billing-item small { color: var(--muted); }
.billing-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.billing-columns h3 { margin: 0 0 8px; font-size: 15px; }
.billing-list { display: grid; gap: 5px; }
.billing-item { grid-template-columns: minmax(0, 1fr) auto; }
.billing-item small { display: block; margin-top: 3px; }
.billing-item-actions { display: flex; gap: 5px; }
.billing-item-actions button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--ink); font-size: 11px; }
.billing-add { margin-top: 10px; }
.billing-add .button { justify-content: center; }
.billing-add .full, .form-grid .full { grid-column: 1 / -1; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.45; }

.transaction-heading { align-items: center; margin: 4px 0 19px; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.filters { display: grid; grid-template-columns: minmax(220px, 1.6fr) minmax(180px, 1fr) minmax(180px, 1fr); gap: 12px; margin-bottom: 15px; }
.filters input, .filters select { width: 100%; }
.transaction-list { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.transaction-list-head, .transaction-row { display: grid; align-items: center; padding: 8px 15px; }
.transaction-list-head { min-height: 34px; border-bottom: 1px solid var(--line); background: #2b3640; color: #b9cbd4; font-size: 12px; font-weight: 700; }
.transaction-list-head span:last-child { text-align: right; }
.transaction-row { position: relative; border-bottom: 1px solid #303b45; font-size: 13px; }
.transaction-row:last-child { border-bottom: 0; }
.transaction-main { min-width: 0; display: flex; flex-direction: column; }
.transaction-main strong { overflow-wrap: anywhere; font-weight: 650; }
.transaction-main span, .transaction-main small { color: var(--muted); font-size: 12px; }
.transaction-main small { overflow-wrap: anywhere; }
.transaction-category { color: #d8e2e7; overflow-wrap: anywhere; }
.transaction-payment { color: #b9c8d0; overflow-wrap: anywhere; }
.transaction-amount { text-align: right; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.transaction-actions { position: relative; justify-self: center; }
.transaction-actions > summary { width: 30px; height: 28px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 4px; color: #aeb8c3; cursor: pointer; font-size: 16px; list-style: none; }
.transaction-actions > summary::-webkit-details-marker { display: none; }
.transaction-actions[open] > summary, .transaction-actions > summary:hover { border-color: var(--line); background: #303943; color: var(--ink); }
.transaction-actions-menu { position: absolute; z-index: 8; top: calc(100% + 3px); right: 0; min-width: 128px; display: grid; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: #20272e; box-shadow: 0 8px 22px #0008; }
.transaction-actions-menu button { padding: 8px 10px; border: 0; border-radius: 3px; background: transparent; color: var(--ink); text-align: left; }
.transaction-actions-menu button:hover { background: #303943; }
.transaction-actions-menu button.danger-action { color: var(--red); }
.empty-state { padding: 40px 18px; color: var(--muted); text-align: center; font-size: 14px; }
.show-more { display: block; width: 100%; margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--cyan); font-size: 14px; font-weight: 650; }
.show-more:hover { background: var(--surface-raised); }

.entry-dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: 0; border: 1px solid #566674; border-radius: 7px; background: #202a33; color: var(--ink); box-shadow: 0 18px 60px #0009; }
.entry-dialog::backdrop { background: #060c10c9; }
.entry-dialog form { padding: 24px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.dialog-heading h2 { font-size: 20px; }
.close-button { width: 30px; height: 30px; border: 0; border-radius: 4px; background: transparent; color: #b1c0c9; font-size: 27px; line-height: 1; }
.close-button:hover { background: #34424d; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; color: #c0cdd3; font-size: 13px; font-weight: 650; }
.form-grid label.full, .form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; }
.form-error { margin: 13px 0 0; color: var(--red); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.toast { position: fixed; z-index: 5; right: 20px; bottom: 18px; max-width: min(450px, calc(100vw - 40px)); padding: 12px 16px; border: 1px solid #3b6e7b; border-radius: 5px; background: #22434e; color: #fff; box-shadow: 0 8px 24px #0007; font-size: 14px; }
.toast.error { border-color: #96524f; background: #6b3336; }
.toast { cursor: pointer; text-transform: none; }
.tree-total { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border: 1px solid #3c5963; border-radius: 5px; background: #20343c; color: #b9cbd1; font-size: 13px; }
.tree-total strong { color: var(--cyan); font-size: 19px; font-variant-numeric: tabular-nums; }
.tree-group { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.tree-group-toggle { width: 100%; min-height: 45px; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto minmax(110px, .5fr); align-items: center; gap: 9px; padding: 7px 13px; border: 0; background: #27333d; color: var(--ink); text-align: left; }
.tree-group-toggle:hover { background: #30404b; }
.tree-disclosure { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #586b76; border-radius: 3px; color: var(--cyan); font-size: 17px; line-height: 1; }
.tree-group-toggle > strong:nth-child(2) { font-size: 14px; }
.tree-group-count { color: var(--muted); font-size: 12px; }
.tree-group-total { color: #d8e4e6; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; }
.tree-category { border-top: 1px solid #303c46; }
.tree-category-row, .tree-subcategory-row { display: grid; grid-template-columns: 26px minmax(130px, 1fr) minmax(100px, .7fr) 135px minmax(100px, .65fr) minmax(105px, .7fr); align-items: center; gap: 9px; min-height: 39px; padding: 5px 14px; }
.tree-category-row:hover, .tree-subcategory-row:hover { background: #26323b; }
.tree-disclosure-button { width: 23px; height: 23px; border: 1px solid #465762; border-radius: 3px; background: #202a32; color: var(--cyan); font-size: 15px; line-height: 1; }
.tree-disclosure-button:disabled { border-color: transparent; color: #72818a; cursor: default; }
.tree-category-name, .tree-subcategory-name { min-width: 0; padding: 3px 0; overflow: hidden; border: 0; background: transparent; color: #e3ebed; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 620; }
.tree-category-name:hover, .tree-subcategory-name:hover { color: var(--cyan); }
.tree-category-count, .tree-sub-count { color: var(--muted); font-size: 11px; }
.classification-select { width: 100%; min-height: 29px; padding: 3px 7px; border-color: #465762; font-size: 12px; }
.tree-amount { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.tree-budget { overflow: hidden; color: #99aab4; text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.tree-subcategories { padding: 2px 0 5px 36px; background: #1b232a; }
.tree-subcategory-row { grid-template-columns: minmax(130px, 1fr) minmax(100px, .7fr) 135px minmax(100px, .65fr); min-height: 34px; padding-left: 20px; }
.tree-subcategory-name { color: #bac9ce; font-size: 12px; font-weight: 500; }
.tree-sub-count { font-size: 11px; }

@media (max-width: 1050px) {
  .topbar-inner { gap: 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 14px; padding: 10px 15px 0; }
  .brand { order: 0; }
  .brand-name { font-size: 17px; }
  .top-actions { order: 1; }
  .top-actions .button { min-height: 33px; padding: 0 9px; font-size: 12px; }
  .nav-button { min-width: 0; padding: 1px 12px 0; }
  .page-shell, .year-mode .page-shell { padding: 18px 15px 38px; }
  h1 { font-size: 25px; }
  .year-summary strong { font-size: 18px; }
  .year-table-wrap { height: calc(100vh - 260px); min-height: 380px; }
  .metric { min-height: 112px; padding: 13px; }
  .metric-value { font-size: 23px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .search-field { grid-column: 1 / -1; }
  .transaction-list-head { display: none; }
  .transaction-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amount" "category payment"; gap: 5px 10px; padding: 12px 14px; }
  .transaction-main { grid-area: main; }
  .transaction-category { grid-area: category; font-size: 12px; }
  .transaction-payment { grid-area: payment; text-align: right; font-size: 12px; }
  .transaction-amount { grid-area: amount; align-self: start; padding-right: 6px; }
}

@media (max-width: 520px) {
  .topbar-inner { justify-content: space-between; }
  .top-actions { order: 2; width: 100%; margin: 0; }
  .top-actions .button { flex: 1; min-height: 36px; font-size: 13px; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
  .period-picker, .period-picker select { width: 100%; }
  .year-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .year-summary > div { min-height: 63px; padding: 8px 11px; }
  .year-summary > div:nth-child(2) { border-right: 0; }
  .year-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .year-summary strong { font-size: 17px; }
  .year-table-wrap { height: calc(100vh - 303px); min-height: 350px; }
  .metrics { gap: 8px; }
  .metric { min-height: 116px; padding: 11px; }
  .metric-label { font-size: 12px; }
  .metric-value { font-size: 20px; }
  .metric-detail { font-size: 11px; }
  .category-heading, .transaction-heading { align-items: flex-start; flex-direction: column; }
  .segmented { width: 100%; }
  .segment { flex: 1; }
  .data-actions { width: 100%; flex-direction: column; }
  .transaction-heading .button { width: 100%; }
  .filters { grid-template-columns: 1fr; }
  .filters .search-field { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.full { grid-column: auto; }
  .entry-dialog form { padding: 18px; }
  .tree-group-toggle { grid-template-columns: 25px minmax(0, 1fr) auto; }
  .tree-group-count { display: none; }
  .tree-group-total { grid-column: 3; grid-row: 1; font-size: 12px; }
  .tree-category-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px 9px; padding: 8px 10px; }
  .tree-category-row .tree-category-name { grid-column: 2; }
  .tree-category-row .tree-category-count { grid-column: 2; grid-row: 2; }
  .tree-category-row .classification-select { grid-column: 3; grid-row: 1 / span 2; width: 108px; }
  .tree-category-row .tree-amount { grid-column: 2; grid-row: 3; text-align: left; }
  .tree-category-row .tree-budget { grid-column: 3; grid-row: 3; }
  .tree-subcategories { padding-left: 18px; }
  .tree-subcategory-row { grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; padding: 7px 9px; }
  .tree-subcategory-row .tree-sub-count { grid-column: 1; }
  .tree-subcategory-row .classification-select { grid-column: 2; grid-row: 1 / span 2; width: 108px; }
  .tree-subcategory-row .tree-amount { grid-column: 1; text-align: left; }
}
.transactions-view .filters { grid-template-columns: minmax(180px, 1.45fr) repeat(4, minmax(120px, 1fr)); align-items: end; }
.transaction-kind-switch { grid-column: 1 / -1; justify-self: start; }
.transaction-list { overflow-x: auto; }
.transaction-list-head, .transaction-row { min-width: 980px; grid-template-columns: 92px minmax(190px, 1.6fr) minmax(170px, 1.35fr) minmax(140px, 1fr) 125px minmax(120px, .9fr) 72px; gap: 10px; }
.transaction-list-head button { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; font-weight: inherit; text-align: left; }
.transaction-list-head button:hover { color: var(--cyan); }
.transaction-list-head button:nth-child(6) { justify-content: flex-end; text-align: right; }
.transaction-sort-indicator { color: #8e9ba7; font-size: 12px; }
.transaction-list-head button[aria-sort="ascending"], .transaction-list-head button[aria-sort="descending"] { color: var(--cyan); }
.transaction-row { min-height: 46px; padding: 6px 12px; }
.transaction-date { color: #d7dbe0; font-variant-numeric: tabular-nums; }
.transaction-main { grid-column: auto; }
.transaction-category { display: flex; min-width: 0; align-items: center; gap: 7px; }
.transaction-category-text { min-width: 0; display: flex; flex-direction: column; }
.transaction-category-text strong, .transaction-category-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-category-text strong { font-size: 12px; font-weight: 600; }
.transaction-category-text small { color: var(--muted); font-size: 10px; }
.transaction-category-icon { width: 20px; flex: none; font-size: 16px; }
.transaction-status { width: fit-content; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 12px; background: #30353c; color: #c3c9d0; white-space: nowrap; font-size: 11px; }
.transaction-status::before { width: 9px; height: 9px; border-radius: 50%; background: currentColor; content: ""; }
.transaction-status.paid { background: #2a3928; color: var(--green); }
.transaction-status.base { background: #30353c; color: #a9b4bf; }
.transaction-amount.expense { color: var(--orange); }
.transaction-amount.income { color: var(--green); }
.transaction-insights { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(280px, 1fr) minmax(330px, 1.15fr); gap: 12px; margin-top: 12px; }
.transaction-insights .panel { min-width: 0; padding: 12px; }
.transaction-insights h3 { margin: 0 0 10px; font-size: 14px; }
.transaction-status-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.transaction-status-totals > div { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-right: 1px solid var(--line); }
.transaction-status-totals > div:last-child { border: 0; }
.transaction-status-totals span { color: var(--muted); font-size: 11px; }
.transaction-status-totals strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.transaction-status-totals > div:first-child strong { color: var(--green); }
.transaction-status-totals > div:nth-child(2) strong { color: var(--red); }
.transaction-status-totals > div:nth-child(3) strong { color: #a9b4bf; }
.transaction-category-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.transaction-category-bar { height: 15px; display: flex; grid-column: 1 / -1; overflow: hidden; gap: 2px; margin-bottom: 2px; border-radius: 4px; }
.transaction-category-bar span { min-width: 2px; height: 100%; }
.transaction-category-item { display: flex; min-width: 0; align-items: center; gap: 5px; font-size: 10px; }
.transaction-category-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; }
.transaction-category-label { overflow: hidden; color: #d2d6dc; text-overflow: ellipsis; white-space: nowrap; }
.transaction-category-item strong { margin-left: auto; color: #fff; }

@media (max-width: 980px) {
  .transactions-view .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transaction-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transaction-insights > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .billing-columns { grid-template-columns: 1fr; }
  .transactions-view .filters { grid-template-columns: 1fr; }
  .transaction-kind-switch { width: 100%; grid-column: auto; }
  .transaction-insights { grid-template-columns: 1fr; }
  .transaction-insights > :last-child { grid-column: auto; }
  .transaction-list { overflow-x: hidden; }
  .transaction-list-head { display: none; }
  .transaction-row { min-width: 0; gap: 6px 9px; padding: 11px 13px; }
  .transaction-main { grid-area: main; }
  .transaction-category { grid-area: category; font-size: 12px; }
  .transaction-payment { grid-area: payment; text-align: right; font-size: 11px; }
  .transaction-date { grid-area: date; color: var(--muted); font-size: 11px; }
  .transaction-status { grid-area: status; justify-self: end; }
  .transaction-amount { grid-area: amount; align-self: start; }
  .transaction-actions { position: absolute; top: 7px; right: 8px; }
  .transaction-actions > summary { width: 28px; height: 26px; }
  .transaction-actions-menu { top: 100%; }
}

/* Annual overview follows the compact graphite dashboard reference. */
:root {
  --ink: #f2f3f6;
  --muted: #a4a9b2;
  --line: #30343b;
  --canvas: #15171b;
  --surface: #1c1f24;
  --surface-raised: #252930;
  --cyan: #08bce8;
  --green: #76d43f;
  --purple: #a52be8;
  --orange: #ff8417;
  --yellow: #f5d500;
  --red: #ff5f62;
  --fixed: #08bce8;
  --variable: #a52be8;
}
html, body { min-height: 100%; background: var(--canvas); }
body { text-transform: capitalize; }
input { text-transform: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 8px auto 8px 8px; z-index: 8; width: 200px; display: flex; flex-direction: column; padding: 8px 0 12px; border: 1px solid #252930; border-radius: 8px; background: #1c1f25; }
.sidebar .brand { min-height: 45px; gap: 10px; padding: 0 14px; }
.brand-mark { width: 25px; height: 28px; border: 0; background: transparent; color: #a45af0; font-size: 29px; }
.brand-name { font-size: 15px; font-weight: 700; }
.side-nav { display: grid; gap: 3px; margin-top: 9px; padding: 0 0; }
.side-nav .nav-button { width: calc(100% - 2px); min-height: 40px; display: flex; align-items: center; gap: 13px; padding: 0 12px; border: 0; border-left: 3px solid transparent; border-radius: 0 5px 5px 0; background: transparent; color: #c6c9cf; text-align: left; font-size: 13px; font-weight: 600; }
.side-nav .nav-button > span { width: 18px; flex: none; color: #c2c7d0; text-align: center; font-size: 20px; line-height: 1; }
.side-nav .nav-button:hover { background: #29232f; color: #fff; }
.side-nav .nav-button.active { border-left-color: #bd58ff; background: linear-gradient(90deg, #6822a7 0%, #40205e 100%); color: #fff; }
.side-nav .nav-button.active > span { color: #fff; }
.sidebar-footer { display: flex; justify-content: space-between; gap: 8px; margin: auto 13px 0; padding-top: 11px; border-top: 1px solid #30343b; color: #858b96; font-size: 11px; }
.sidebar-footer span { color: #c8cbd2; }
.main-shell { min-width: 0; min-height: 100vh; margin-left: 216px; }
.topbar { position: sticky; top: 0; z-index: 6; border: 0; border-bottom: 1px solid #24282e; background: #15171bf2; backdrop-filter: blur(10px); }
.topbar-inner { max-width: none; min-height: 48px; justify-content: flex-end; padding: 0 18px; }
.top-actions { gap: 8px; }
.top-actions .button { min-height: 33px; border-radius: 5px; font-size: 12px; }
.top-actions .button-primary { border-color: #a633ed; background: linear-gradient(110deg, #a62be8, #7428cb); color: white; }
.top-actions .button-primary:hover { background: #b44cf0; }
.top-actions .button > span { margin-right: 6px; font-size: 17px; line-height: 1; }
.page-shell, .year-mode .page-shell { max-width: none; padding: 12px 16px 22px 12px; }
.page-heading { align-items: center; gap: 15px; margin: 0 0 12px; }
.page-title-line { display: flex; align-items: center; gap: 17px; }
.page-title-line h1 { margin: 0; font-size: 28px; line-height: 1.05; }
.eyebrow, .page-heading .muted { display: none; }
.year-summary { gap: 12px; margin-bottom: 11px; border: 0; border-radius: 0; background: transparent; }
.year-summary > div { min-height: 77px; justify-content: center; gap: 1px; padding: 9px 14px; border: 1px solid #30343b; border-top: 3px solid var(--green); border-radius: 6px; background: linear-gradient(115deg, #1d2025, #1a1d21); }
.year-summary > div:nth-child(2) { border-top-color: var(--yellow); }
.year-summary > div:nth-child(3) { border-top-color: var(--orange); }
.year-summary > div:nth-child(4) { border-top-color: var(--red); background: linear-gradient(115deg, #2c1d21, #1f1a1e); }
.year-summary > div.is-clear { border-top-color: var(--green); background: linear-gradient(115deg, #1d2a21, #1a1f1c); }
.year-summary > div:nth-child(5) { border-top-color: var(--cyan); }
.year-summary span { font-size: 12px; }
.year-summary strong { font-size: 25px; }
.annual-chart, .panel { border: 1px solid #30343b; border-radius: 6px; background: linear-gradient(145deg, #1c1f24, #191c20); }
.annual-chart { margin-bottom: 9px; padding: 8px 12px 6px; }
.annual-insights h2 { margin: 0; font-size: 14px; font-weight: 700; }
.annual-chart-canvas { height: clamp(145px, 19vh, 196px); margin-top: 0; }
.annual-chart-canvas svg { width: 100%; height: 100%; overflow: visible; }
.chart-gridline { stroke: #34383f; stroke-width: 1; }
.chart-axis-label, .chart-month-label { fill: #d6d8dd; font-family: inherit; font-size: 11px; }
.chart-month-label { font-size: 12px; }
.chart-selection { fill: #1d2830; fill-opacity: .72; stroke: #56616d; stroke-dasharray: 3 2; stroke-width: 1; }
.chart-income-bar { fill: var(--green); opacity: .92; }
.chart-expense-bar { fill: var(--orange); opacity: .94; }
.chart-target { stroke: var(--yellow); stroke-width: 2; stroke-dasharray: 9 5; }
.chart-balance-line { fill: none; stroke: var(--cyan); stroke-width: 2.2; }
.chart-balance-point { fill: var(--cyan); stroke: #11242b; stroke-width: 1; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:focus { stroke: #bec5d0; stroke-dasharray: 3 2; outline: none; }
.annual-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 19px; padding: 0 0 1px; color: #e3e5e9; font-size: 11px; }
.annual-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 11px; height: 11px; display: inline-block; border-radius: 3px; background: var(--green); }
.expense-dot { background: var(--orange); }
.legend-line { width: 21px; display: inline-block; border-top: 2px solid var(--cyan); }
.target-line { border-top: 2px dashed var(--yellow); }
.year-table-wrap { border-color: #30343b; border-radius: 6px; background: #191c20; }
.year-table { width: 100%; }
.year-table th, .year-table td { padding: 3px 4px; border-color: #2b3036; }
.year-table thead th { background: #22262c; }
.year-table thead th:nth-child(1), .year-table td.year-category { width: 168px; text-align: left; }
.year-table thead th:nth-child(2), .year-table thead th:nth-child(16) { color: #10c8f1; }
.year-table thead th:nth-child(1), .year-table td.year-category { position: sticky; left: 0; z-index: 2; }
.year-table thead th:nth-child(1) { z-index: 5; }
.year-table thead th:nth-child(2) button { justify-content: flex-end; text-align: right; }
.year-table thead th:nth-child(n+3):nth-child(-n+14) button, .year-table thead th:nth-child(n+15) button { justify-content: flex-end; text-align: right; }
.year-row { --row-bg: #1d2025; }
.year-row:nth-of-type(even) { --row-bg: #202329; }
.year-row td.year-category { background: var(--row-bg); }
.year-row.year-parent td { --row-bg: #20242a; }
.year-row.year-parent td.year-category { color: #10c8f1; }
.year-row.year-parent.income td.year-category { color: var(--green); }
.year-group-toggle { min-height: 20px; gap: 7px; }
.year-disclosure { width: 15px; height: 15px; border-color: #56616b; border-radius: 3px; color: #15c8f1; font-size: 12px; }
.year-group-icon { width: 18px; font-size: 13px; }
.year-row.year-child td.year-category.year-subcategory { width: 190px; padding-left: 28px; color: #d2d5da; font-weight: 430; }
.year-row.year-child td.year-category.year-subcategory { position: sticky; left: 0; z-index: 2; box-shadow: none; }
.child-indent { display: none; }
.chart-axis-label, .chart-month-label { text-transform: none; }
.year-row td.year-budget, .year-row td.year-annual-goal { color: #10c8f1; }
.year-row td.year-current { box-shadow: inset 0 0 0 999px #d7e7f009; }
.year-row.year-total td { height: 30px; }
.year-row.annual-section-row { --row-bg: #292d31; }
.year-row.annual-section-row td { height: 32px; font-weight: 720; }
.year-row.annual-section-row.expense td.year-category { color: var(--orange); }
.year-row.annual-section-row.income { --row-bg: #1c3028; }
.year-row.annual-section-row.income td.year-category { color: var(--green); }
.annual-section-toggle .year-disclosure { width: 16px; height: 16px; }
.annual-insights { display: grid; grid-template-columns: 2fr 1.1fr; gap: 10px; margin-top: 9px; }

.category-page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.category-page-heading h2 { margin-bottom: 3px; font-size: 23px; }
.category-page-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.category-page-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.category-create-actions { display: flex; align-items: center; gap: 8px; }
.category-kind-switch { display: inline-flex; }
.category-kind-switch .segment { min-width: 90px; }
.category-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 13px; }
.category-metrics article { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border: 1px solid #30343b; border-top: 3px solid #41464d; border-radius: 6px; background: #1c1f24; }
.category-metrics article.budget { border-top-color: var(--yellow); }
.category-metrics article.spent { border-top-color: var(--orange); }
.category-metrics article.over { border-top-color: var(--red); }
.category-metrics span { color: #c1c5cc; font-size: 12px; }
.category-metrics strong { overflow-wrap: anywhere; color: #f3f4f6; font-size: 21px; font-variant-numeric: tabular-nums; }
.category-metrics .budget strong { color: var(--yellow); }
.category-metrics .spent strong { color: var(--orange); }
.category-metrics .over strong { color: var(--red); }
.manager-table-panel { overflow: hidden; border-color: #30343b; background: #1c1f24; }
.manager-panel-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid #30343b; }
.manager-panel-heading h3 { margin: 0; font-size: 16px; }
.manager-search input { width: 200px; min-height: 32px; padding: 5px 9px; border-color: #3c424a; background: #191c20; font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.manager-table-scroll { overflow-x: auto; }
.manager-table { width: 100%; min-width: 1000px; border-collapse: collapse; font-size: 12px; }
.manager-table th, .manager-table td { height: 42px; padding: 6px 9px; border-right: 1px solid #30343b; border-bottom: 1px solid #30343b; }
.manager-table th { height: 35px; background: #202329; color: #d5d8de; text-align: left; font-size: 11px; font-weight: 650; }
.manager-table th:nth-child(n+3):nth-child(-n+5), .manager-table td:nth-child(n+3):nth-child(-n+5) { text-align: right; }
.manager-table th:nth-child(6), .manager-table td:nth-child(6) { width: 190px; }
.manager-table th:last-child, .manager-table td:last-child { width: 78px; border-right: 0; text-align: center; }
.manager-category-row { background: #1e2126; }
.manager-category-row:hover, .manager-category-row.selected { background: #252a31; }
.manager-category-row.exceeded td:nth-child(4) { background: #702c3833; }
.manager-category-cell { display: flex; align-items: center; gap: 8px; min-width: 195px; }
.manager-disclosure { width: 17px; height: 17px; flex: none; padding: 0; border: 1px solid #515762; border-radius: 3px; background: transparent; color: var(--cyan); line-height: 1; }
.manager-category-icon { width: 23px; flex: none; font-size: 16px; text-align: center; }
.manager-category-name { min-width: 0; padding: 2px 0; overflow: hidden; border: 0; background: transparent; color: #12c8ef; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.manager-sub-list { max-width: 275px; overflow: hidden; color: #c4c8ce; text-overflow: ellipsis; white-space: nowrap; }
.manager-money { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.manager-money.is-over { color: var(--red); }
.manager-usage-cell { display: flex; align-items: center; gap: 9px; }
.manager-usage-track { height: 13px; flex: 1; overflow: hidden; border-radius: 10px; background: #343940; }
.manager-usage-fill { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #a53be6, #8731ca); }
.manager-usage-fill.over { background: linear-gradient(90deg, #e2499a, #d5354b); }
.manager-usage-label { width: 35px; color: #eef0f3; text-align: right; font-variant-numeric: tabular-nums; }
.manager-actions { white-space: nowrap; }
.icon-action { width: 27px; height: 27px; margin: 0 2px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #d5d8de; font-size: 16px; }
.icon-action:hover { background: #363b43; color: #fff; }
.danger-action:hover { color: var(--red); }
.manager-subcategory-row { background: #191c20; color: #c7cbd1; }
.manager-subcategory-cell { padding-left: 42px !important; color: #e0e2e6; }
.manager-sub-note { color: #9fa5ad; font-size: 11px; }
.icon-field { min-width: 0; margin: 0; padding: 9px 10px 10px; border: 1px solid #424851; border-radius: 5px; }
.icon-field legend { padding: 0 5px; color: #c3c7cd; font-size: 12px; }
.icon-options { max-height: 190px; display: grid; grid-template-columns: repeat(12, minmax(28px, 1fr)); gap: 5px; overflow-y: auto; padding: 2px 3px 2px 0; scrollbar-color: #606b77 #252a31; }
.icon-choice { aspect-ratio: 1; min-width: 28px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: #23272d; font-size: 17px; }
.icon-choice:hover, .icon-choice.selected { border-color: var(--purple); background: #39234a; }
@media (max-width: 980px) {
  .category-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .category-page-heading { align-items: stretch; flex-direction: column; }
  .category-page-actions { justify-content: space-between; flex-wrap: wrap; }
  .category-create-actions { justify-content: flex-end; flex-wrap: wrap; }
  .category-page-heading h2 { font-size: 21px; }
  .category-metrics { gap: 7px; }
  .category-metrics article { padding: 10px; }
  .category-metrics strong { font-size: 17px; }
  .manager-panel-heading { align-items: flex-start; flex-direction: column; }
  .manager-search, .manager-search input { width: 100%; }
  .icon-options { grid-template-columns: repeat(8, minmax(28px, 1fr)); }
}
.annual-insights .panel { min-width: 0; padding: 9px 11px; }
.deviation-list { display: grid; align-content: start; max-height: 168px; margin-top: 7px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.deviation-row { min-width: 0; display: grid; grid-template-columns: 19px minmax(0, 1fr) auto 86px; align-items: center; gap: 8px; border-bottom: 1px solid #2b3036; font-size: 12px; }
.deviation-row strong { text-align: right; }
.deviation-percent { color: var(--red); font-size: 11px; font-variant-numeric: tabular-nums; }
.deviations-panel h2 small { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 500; }
.deviation-row:last-child { border-bottom: 0; }
.deviation-rank { width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: #1a1d20; font-size: 10px; font-weight: 800; }
.rank-1 { background: #ff5054; color: white; }
.rank-2 { background: var(--purple); color: white; }
.rank-3 { background: #dc943b; color: #202020; }
.deviation-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deviation-row strong { white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 1150px) {
  .sidebar { width: 66px; }
  .sidebar .brand { justify-content: center; padding: 0; }
  .sidebar .brand-name, .sidebar-footer { display: none; }
  .side-nav .nav-button { justify-content: center; width: 48px; margin: 0 auto; padding: 0; border-left-width: 2px; }
  .side-nav .nav-button { font-size: 0; }
  .side-nav .nav-button > span { font-size: 21px; }
  .main-shell { margin-left: 78px; }
  .annual-insights { grid-template-columns: 1.4fr 1fr; }
  .deviations-panel { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .sidebar { inset: auto 0 0; width: 100%; height: 61px; flex-direction: row; padding: 0 5px env(safe-area-inset-bottom); border-width: 1px 0 0; border-radius: 0; background: #191c21; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .side-nav { width: 100%; display: flex; justify-content: space-around; gap: 3px; margin: 0; }
  .side-nav .nav-button, .side-nav .nav-button:not(.active) { width: auto; min-width: 0; height: 54px; display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 1px; margin: 0; padding: 2px; border: 0; border-radius: 5px; font-size: 9px; }
  .side-nav .nav-button.active { background: #43205e; }
  .side-nav .nav-button > span { width: auto; font-size: 19px; }
  .main-shell { margin: 0 0 61px; }
  .topbar-inner { min-height: 44px; padding: 0 10px; }
  .top-actions .button { min-height: 31px; padding: 0 8px; font-size: 10px; }
  .page-shell, .year-mode .page-shell { padding: 11px 9px 18px; }
  .page-title-line h1 { font-size: 23px; }
  .year-summary { gap: 7px; }
  .year-summary > div { min-height: 65px; padding: 7px 9px; }
  .year-summary strong { font-size: 18px; }
  .annual-chart { padding: 8px 6px 6px; }
  .annual-chart-canvas { height: 150px; }
  .chart-axis-label { font-size: 10px; }
  .chart-month-label { font-size: 10px; }
  .annual-legend { gap: 6px 10px; font-size: 9px; }
  .year-table-wrap { max-height: 52vh; min-height: 220px; }
  .year-table { min-width: 1260px; }
  .annual-insights { grid-template-columns: 1fr; }
  .deviations-panel { grid-column: auto; }
}

.monthly-payments, .category-section { text-transform: none; }
.monthly-payments { margin: 20px 0; }
.monthly-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.monthly-heading h2 { font-size: 18px; margin-bottom: 3px; }
.monthly-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.monthly-table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: #1d2025; }
.monthly-budget-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.monthly-budget-table { min-width: 1180px; }
.monthly-budget-table th { padding: 9px 10px; text-align: left; background: #292e35; color: #bdc7d0; font-size: 11px; white-space: nowrap; }
.monthly-budget-table td { padding: 7px 10px; vertical-align: middle; border-top: 1px solid var(--line); }
.monthly-status-detail { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; overflow-wrap: anywhere; }
.monthly-money { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.monthly-positive { color: var(--green); }
.monthly-negative { color: var(--red); }
.monthly-goal { color: var(--cyan); }
.monthly-payments .empty-inline { margin-top: 10px; padding: 10px; }
.monthly-actions { min-width: 170px; max-width: 235px; }
.monthly-action { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; margin: 2px 3px 2px 0; padding: 5px 8px; border: 1px solid #64507a; border-radius: 4px; background: #402650; color: #e8d4ff; font-size: 11px; text-align: center; }
.monthly-action:hover { background: #53316a; }
.monthly-action.secondary { border-color: #434a54; background: #252a31; color: #c8d2dd; }
.monthly-action.secondary:hover { background: #343a44; }
.payment-badge { display: inline-block; padding: 3px 7px; border-radius: 4px; background: #353942; color: #c5ced7; font-size: 10px; white-space: nowrap; }
.payment-badge.paid { background: #293b2b; color: var(--green); }
.payment-badge.pending { background: #3e3425; color: var(--orange); }
.payment-badge.overdue { background: #452a2d; color: var(--red); }
.payment-badge.unknown { background: #39372d; color: var(--yellow); }
.monthly-budget-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.monthly-budget-actions .button { min-height: 30px; font-size: 11px; }
.monthly-budget-name { min-width: 240px; max-width: 290px; overflow-wrap: anywhere; }
.monthly-disclosure { width: 100%; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; font-size: 12px; }
.monthly-disclosure > span:first-child { flex: none; width: 17px; text-align: center; color: var(--cyan); }
.monthly-disclosure:disabled { cursor: default; opacity: 1; }
.monthly-budget-parent { background: #272c33; }
.monthly-budget-parent .monthly-budget-name { color: var(--cyan); }
.monthly-budget-child .monthly-budget-name { padding-left: 27px; }
.monthly-budget-detail { color: #aeb7c3; background: #191c21; }
.monthly-budget-detail .monthly-budget-name { padding-left: 52px; font-size: 11px; }
.monthly-budget-table td:nth-child(6) { min-width: 86px; }
.monthly-usage-label { display: block; color: var(--muted); text-align: right; font-size: 10px; }
.monthly-usage { display: block; width: 76px; height: 4px; margin-top: 4px; appearance: none; border: 0; border-radius: 2px; background: #3a3f47; accent-color: var(--green); }
.monthly-usage::-webkit-progress-bar { background: #3a3f47; border-radius: 2px; }
.monthly-usage::-webkit-progress-value { background: var(--green); border-radius: 2px; }
.monthly-usage.over::-webkit-progress-value { background: var(--red); }
#billingDialog { width: min(760px, calc(100vw - 24px)); }
#settleExpenseDescription, #payInvoiceDescription { text-transform: none; }

@media (max-width: 980px) {
  .monthly-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 700px) {
  .monthly-heading .segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .monthly-heading .segment { min-width: 0; min-height: 38px; padding: 6px 3px; font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
  .monthly-action { min-height: 34px; }
}

/* Aba Mês: contas do mês em grupos, com ✓ e menu ⋯ */
.metric-track { display: block; height: 6px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: #33404a; }
.metric-track span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--green); transition: width .2s ease; }
.monthly-heading .button { white-space: nowrap; }
.monthly-search { display: block; margin-bottom: 12px; }
.monthly-search input { width: 100%; min-width: 0; }
.bill-groups { display: grid; gap: 12px; }
.bill-group { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: visible; }
.bill-group-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 5px 5px 0 0; background: var(--surface-raised); color: var(--ink); font: inherit; text-align: left; }
.bill-group-head:disabled { cursor: default; opacity: 1; }
.bill-group-paid .bill-group-head { cursor: pointer; }
.bill-group-paid .bill-group-head[aria-expanded="false"] { border-bottom: 0; border-radius: 5px; }
.bill-group-paid .bill-group-head::after { content: "▾"; margin-left: 8px; color: var(--muted); }
.bill-group-paid .bill-group-head[aria-expanded="false"]::after { content: "▸"; }
.bill-group-title { display: inline-flex; align-items: center; gap: 8px; }
.bill-group-count { min-width: 22px; padding: 1px 7px; border-radius: 10px; background: #36424c; color: #c8d2dd; font-size: 12px; text-align: center; }
.bill-group-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.bill-group-overdue { border-color: #6a3a3d; }
.bill-group-overdue .bill-group-title strong, .bill-group-overdue .bill-group-total { color: var(--red); }
.bill-group-unknown .bill-group-title strong, .bill-group-unknown .bill-group-total { color: var(--yellow); }
.bill-group-paid .bill-group-title strong, .bill-group-paid .bill-group-total { color: var(--green); }
.bill-group-help { margin: 0; padding: 8px 14px 0; color: var(--muted); font-size: 12px; }
.bill-list { display: grid; }
.bill-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 120px 130px 34px; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid #2c363f; }
.bill-list > :first-child .bill-row, .bill-list > .bill-row:first-child { border-top: 0; }
.bill-main { min-width: 0; display: grid; gap: 2px; }
.bill-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-main small, .bill-due small, .bill-amount small { color: var(--muted); font-size: 12px; }
.bill-due { display: grid; gap: 2px; font-size: 13px; }
.bill-amount { display: grid; gap: 2px; text-align: right; font-variant-numeric: tabular-nums; }
.bill-paid .bill-main strong { color: #b9c5ce; }
.bill-check { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 2px solid #5b6873; border-radius: 50%; background: transparent; color: transparent; font-size: 16px; font-weight: 800; cursor: pointer; }
.bill-check:hover { border-color: var(--green); color: var(--green); }
.bill-check.paid { border-color: var(--green); background: var(--green); color: #14200f; }
.bill-check.paid:hover { border-color: var(--red); background: transparent; color: var(--red); }
.bill-check:disabled { cursor: default; }
.bill-overdue .bill-check { border-color: var(--red); }
.bill-check-placeholder { display: inline-block; width: 32px; }
.bill-menu { justify-self: end; }
.bill-items { display: grid; gap: 4px; margin: 0; padding: 4px 14px 12px 62px; list-style: none; color: #c8d2dd; font-size: 12px; }
.bill-items li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed #2c363f; }
.bill-items strong { font-variant-numeric: tabular-nums; }
.monthly-budget-table .bill-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.monthly-budget-table .bill-check { width: 28px; height: 28px; font-size: 14px; }
@media (max-width: 700px) {
  .bill-row { grid-template-columns: 30px minmax(0, 1fr) auto 26px; grid-template-areas: "check main amount menu" "check due amount menu"; column-gap: 8px; row-gap: 2px; padding: 10px 10px 10px 12px; }
  .bill-main strong { white-space: normal; overflow-wrap: anywhere; }
  .bill-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bill-amount strong { font-size: 14px; }
  .bill-check { width: 28px; height: 28px; font-size: 14px; }
  .bill-row > .bill-check, .bill-row > .bill-check-placeholder { grid-area: check; }
  .bill-row > .bill-main { grid-area: main; }
  .bill-row > .bill-due { grid-area: due; display: flex; flex-wrap: wrap; gap: 0 8px; color: var(--muted); font-size: 12px; }
  .bill-row > .bill-amount { grid-area: amount; }
  .bill-row > .bill-menu { grid-area: menu; position: relative; top: auto; right: auto; }
  .bill-items { padding-left: 58px; }
  .bill-group-head { padding: 10px 12px; }
}
.bill-menu.transaction-actions { position: relative; top: auto; right: auto; }

/* Topo da aba Mês: cores pelo significado e textos sem maiúscula em cada palavra */
#overviewView .metrics { text-transform: none; }
#overviewView .metric-label { text-transform: capitalize; }
#overviewView .metric-value { white-space: nowrap; }
#overviewView .metric:nth-child(1) .metric-value { color: var(--orange); }
#overviewView .metric:nth-child(2) .metric-value { color: var(--yellow); }
#overviewView .metric:nth-child(4) .metric-value { color: var(--ink); }
@media (max-width: 520px) {
  #overviewView .metric { min-height: 0; padding: 12px; }
  #overviewView .metric-value { font-size: 19px; }
}
#settleExpenseAmountHelp, #settleExpenseDescription { text-transform: none; }

/* Tela Mês: seletor A pagar · Lançamentos · Orçamento */
.month-panel-switch { width: fit-content; margin: 4px 0 16px; text-transform: none; }
.month-panel-switch .segment { min-width: 110px; }
.transactions-view.month-panel { margin-top: 4px; }
/* ✓ e ⋯ no fim de cada lançamento */
.transaction-row-controls { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.transaction-row-controls .bill-check { width: 28px; height: 28px; font-size: 14px; }
.bill-check.card-shortcut { border-style: dashed; border-color: #4f5d69; color: inherit; font-size: 13px; filter: grayscale(.4); }
.bill-check.card-shortcut:hover { border-color: var(--cyan); filter: none; }
.transaction-fixed .transaction-main small { color: var(--cyan); }
@media (max-width: 700px) {
  .month-panel-switch { width: 100%; }
  .month-panel-switch .segment { min-width: 0; flex: 1; }
  .transaction-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "main amount controls" "category status controls" "date payment controls"; }
  .transaction-row-controls { grid-area: controls; flex-direction: column; gap: 6px; align-self: center; }
  .transaction-row-controls .transaction-actions { position: relative; top: auto; right: auto; }
  .transaction-amount { padding-right: 0; }
}
.transaction-status.pending { background: #3e3425; color: var(--orange); }
.transaction-status.overdue { background: #482a29; color: var(--red); }
.transaction-status.unknown { background: #39372d; color: var(--yellow); }
/* Rodapé de dados e filtros recolhíveis no celular */
.data-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); text-transform: none; }
.data-footer h3 { margin: 0 0 3px; font-size: 14px; }
.data-footer p { margin: 0; color: var(--muted); font-size: 12px; }
.filters-toggle { display: none; }
@media (max-width: 700px) {
  .data-footer { flex-direction: column; align-items: stretch; }
  .filters-toggle { display: block; width: 100%; margin-bottom: 10px; }
  .transactions-view .filters:not(.filters-open) > label:not(.search-field) { display: none; }
}
.billing-check { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); text-transform: none; }
.billing-check h3 { margin: 0 0 6px; }
.billing-check-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 8px; }
.billing-check-row label { display: grid; gap: 4px; }

/* Menu na barra do topo em telas largas: a página ganha a largura que era da lateral.
   No celular (até 700px) continua a barra de baixo. */
@media (min-width: 701px) {
  .sidebar { position: fixed; inset: 0 auto auto 0; z-index: 9; width: auto; height: 48px; flex-direction: row; align-items: center; gap: 18px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; }
  .sidebar .brand { display: flex; min-height: 0; padding: 0; }
  .sidebar .brand-name { display: inline; }
  .sidebar-footer { display: none; }
  .side-nav { display: flex; gap: 4px; margin: 0; }
  .side-nav .nav-button { width: auto; min-height: 34px; margin: 0; padding: 0 12px; gap: 8px; justify-content: flex-start; border-left: 0; border-radius: 6px; font-size: 13px; }
  .side-nav .nav-button > span { width: auto; font-size: 16px; }
  .side-nav .nav-button.active { border-left: 0; }
  .main-shell { margin-left: 0; }
  /* Abas leves: só texto; a ativa fica branca com um traço fino. O roxo fica para o
     "Novo lançamento". Os ícones continuam na barra de baixo do celular. */
  .sidebar { gap: 30px; }
  .side-nav { gap: 2px; }
  .side-nav .nav-button > span { display: none; }
  .side-nav .nav-button { min-height: 48px; padding: 0 12px; border-radius: 0; color: #8f9aa3; font-size: 14px; font-weight: 600; box-shadow: none; }
  .side-nav .nav-button:hover { background: transparent; color: #e6eaee; }
  .side-nav .nav-button.active { background: transparent; color: #fff; box-shadow: inset 0 -2px 0 var(--cyan); }
}
@media (min-width: 701px) and (max-width: 900px) {
  .sidebar .brand-name { display: none; }
}
@media (max-width: 1150px) {
}
@media (max-width: 700px) {
}

/* Recorrências */
.monthly-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.recurrence-dialog { width: min(720px, calc(100vw - 24px)); }
.recurrence-dialog p, .recurrence-dialog small, .recurrence-list, .recurrence-dialog .form-error { text-transform: none; }
.recurrence-toolbar { display: flex; justify-content: flex-end; margin: 10px 0; }
.recurrence-list { display: grid; gap: 4px; max-height: min(60vh, 560px); overflow-y: auto; padding-right: 4px; }
.recurrence-section-title { margin: 12px 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.recurrence-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.recurrence-item:hover { border-color: var(--cyan); }
.recurrence-item-main { min-width: 0; display: grid; gap: 2px; }
.recurrence-item-main small { color: var(--muted); font-size: 12px; }
.recurrence-item-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.recurrence-delete { margin-right: auto; border-color: #6a3a3d; color: var(--red); }
@media (max-width: 700px) {
  .monthly-heading-actions { width: 100%; }
  .monthly-heading-actions .button { flex: 1; }
}

/* Visão geral: 4 cartões (entradas, despesas, meta, gastos acima da meta), cor pela classe */
.year-summary > div.year-card-income { border-top-color: var(--green); } .year-summary > div.year-card-income strong { color: var(--green); }
.year-summary > div.year-card-expenses { border-top-color: var(--orange); } .year-summary > div.year-card-expenses strong { color: var(--orange); }
.year-summary > div.year-card-budget { border-top-color: var(--yellow); background: linear-gradient(115deg, #1d2025, #1a1d21); } .year-summary > div.year-card-budget strong { color: var(--yellow); }
.year-summary > div.year-card-over { border-top-color: var(--red); background: linear-gradient(115deg, #2c1d21, #1f1a1e); } .year-summary > div.year-card-over strong { color: var(--red); }
.year-summary > div.year-card-over.is-clear { border-top-color: var(--green); background: linear-gradient(115deg, #1d2a21, #1a1f1c); } .year-summary > div.year-card-over.is-clear strong { color: var(--green); }
.year-card-over small { color: #f0a3a6; font-size: 12px; font-weight: 600; }
.year-card-over.is-clear small { color: var(--green); }
@media (max-width: 1150px) { .year-summary {} }
@media (max-width: 700px) { .year-summary > div:nth-child(5) { grid-column: auto; } }
/* Entradas: cada fonte direto sob a seção */
.year-row.year-income-source td.year-category { padding-left: 34px; color: var(--green); font-weight: 600; }
/* Comprometimento da receita, por extenso */
.participation-panel h2 small, .deviations-panel h2 small { margin-left: 6px; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: none; }
.commitment-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(var(--commitment-rows, 10), auto); grid-auto-flow: column; column-gap: 22px; max-height: 210px; margin-top: 8px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.commitment-row { min-width: 0; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 54px; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #2b3036; font-size: 12px; }
.commitment-rank { color: var(--muted); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.commitment-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.commitment-value { color: #b9c5ce; font-variant-numeric: tabular-nums; }
.commitment-share { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .commitment-list { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; max-height: none; } }

/* Tabela anual mais leve (07/10/2026): linhas altas, só divisões horizontais,
   centavos discretos, colunas de resumo destacadas, ordenação só quando usada. */
.year-table { font-size: 12.5px; }
.year-table th, .year-table td { height: 36px; border-bottom: 1px solid #2a2f36; }
.year-table thead th { height: 38px; font-size: 12px; text-transform: capitalize; }
.year-table thead th:nth-child(15), .year-table td:nth-child(15) { border-left: 0; }
.year-row.annual-section-row td, .year-row.year-total td { height: 38px; }
.year-row.year-parent td { font-weight: 560; }
.year-table thead th:nth-child(15) { background: #3a3422; color: var(--yellow); }
.year-table thead th:nth-child(16) { background: #1b3542; color: var(--cyan); }
.year-row td.year-annual { background-image: linear-gradient(#f1c84d14, #f1c84d14); color: #f5d77a; }
.year-row:hover td.year-annual { background-image: linear-gradient(#f1c84d22, #f1c84d22); }
.year-row td.year-annual-goal { background-image: linear-gradient(#25bce910, #25bce910); }
.year-row:hover td.year-annual-goal { background-image: linear-gradient(#25bce91c, #25bce91c); }
.year-disclosure, .annual-section-toggle .year-disclosure { width: 14px; height: 14px; border: 0; color: #8c99a4; font-size: 17px; font-weight: 400; transition: transform .15s ease; }
.year-disclosure.open { transform: rotate(90deg); }
.year-group-toggle:hover .year-disclosure { color: var(--cyan); }
.year-group-name { font-size: 12.5px; }
.annual-section-toggle .year-group-name { font-size: 13px; }
.year-table thead th[aria-sort="none"] .sort-indicator { opacity: 0; }
.year-table thead th:hover .sort-indicator, .year-table thead th:focus-within .sort-indicator { opacity: 1; }
.year-row.year-child td.year-category.year-subcategory, .year-row.year-income-source td.year-category { padding-left: 30px; }
.year-row.year-total td:not(.year-category) { font-weight: 600; }
.year-table td:not(.year-category) { padding-left: 2px; }

/* 07/10/2026: blocos separados, linhas verticais de volta, cabeçalho corrigido */
.year-summary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.year-summary > div.year-card-balance { border-top-color: var(--cyan); } .year-summary > div.year-card-balance strong { color: var(--cyan); }
.year-summary > div.year-card-balance strong.negative { color: var(--red); }
.year-card-balance small { color: var(--muted); font-size: 11px; text-transform: none; }
@media (max-width: 1150px) { .year-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .year-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .year-summary > div.year-card-balance { grid-column: 1 / -1; } }
/* "meta/mês" herdava a fixação lateral antiga (left: 180px) e abria um buraco escuro */
.year-table thead th:nth-child(2) { left: auto; box-shadow: none; }
.year-table th, .year-table td { border-right: 1px solid #2a2f36; }
.year-table th:last-child, .year-table td:last-child { border-right: 0; }
.year-table td.year-category { border-right-color: #3a414a; }
.year-block-gap td { height: 14px; padding: 0; border: 0; background: var(--canvas); }
.year-row.annual-section-row td { border-top: 1px solid #3a414a; }

/* 07/10/2026: valores em fonte normal, centavos do mesmo tamanho; título dentro da tabela;
   desvios ocupando o quadro inteiro. */
.year-table td:not(.year-category) { font-weight: 400; }
.year-row.annual-section-row td:not(.year-category), .year-row.year-total td:not(.year-category) { font-weight: 500; }
.year-row td.year-annual { font-weight: 500; }
.year-table thead th:nth-child(1) { text-transform: none; }
.year-table thead th:nth-child(1) button { color: #e9edf1; font-size: 12.5px; font-weight: 700; white-space: normal; line-height: 1.15; text-align: left; }
.annual-insights > .panel { display: flex; flex-direction: column; }
.deviations-panel .deviation-list { flex: 1 1 0; min-height: 0; max-height: none; }
.deviation-list { gap: 0; }
.deviation-row { padding: 6px 0; }

/* Seletor de ano */
.year-picker { display: inline-flex; position: relative; }
.year-select { appearance: none; -webkit-appearance: none; min-height: 32px; padding: 3px 30px 3px 12px; border: 1px solid #3a414a; border-radius: 16px; background: #1d2127 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23c5c8ce' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: #f1f2f5; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.year-select:hover { border-color: var(--cyan); }

/* Saldo acumulado: bloco próprio, valores verdes (sobra) ou vermelhos (falta) */
.year-static-label { display: inline-flex; align-items: center; cursor: default; }
.year-disclosure-spacer { visibility: hidden; }
.year-row.balance { --row-bg: #16263a; }
.year-row.balance td { border-top: 1px solid #2b4f78; border-bottom: 1px solid #2b4f78; }
.year-row.balance td.year-category { color: #9fd0ff; box-shadow: inset 3px 0 0 #4aa3ff; }
.year-row.balance .year-group-name { font-size: 13px; font-weight: 700; white-space: nowrap; }
.year-row.balance .year-static-label { gap: 6px; }
.year-row.balance td.year-month, .year-row.balance td.year-annual { color: var(--green); }
.year-row.balance td.year-month.negative, .year-row.balance td.year-annual.negative { color: var(--red); }
.year-row.balance td.year-annual { background-image: linear-gradient(#ffffff0a, #ffffff0a); font-weight: 600; }

/* R$ nas colunas de resumo; borda colorida à esquerda em cada bloco */
.year-table .currency { color: inherit; opacity: .7; font-size: .9em; }
.year-row.annual-section-row.expense td.year-category { box-shadow: inset 3px 0 0 var(--orange); }
.year-row.annual-section-row.income td.year-category { box-shadow: inset 3px 0 0 var(--green); }
.year-row.annual-section-row.expense td { border-top-color: #6a4a2c; border-bottom: 1px solid #6a4a2c; }
.year-row.annual-section-row.income td { border-top-color: #2f6a45; border-bottom: 1px solid #2f6a45; }
.year-row.year-total td.year-month { font-weight: 400; }
/* Com R$ nas colunas de resumo a tabela cabe a partir de ~1512px (MacBook 14"); abaixo rola de lado com a categoria fixa. */
.year-table { min-width: 1444px; }
.year-table thead th:nth-child(1), .year-table td.year-category, .year-row.year-child td.year-category.year-subcategory { width: 160px; }
.year-table thead th:nth-child(2) { width: 94px; }
.year-table thead th:nth-child(n+3):nth-child(-n+14) { width: 75px; }
.year-table thead th:nth-child(n+15):nth-child(-n+17) { width: 98px; }

/* Tabela anual inteira na página (sem rolagem interna); cabeçalho acompanha a página. */
.year-table-wrap { height: auto; max-height: none; min-height: 0; overflow: visible; }
.year-table thead th { top: 48px; }
@media (max-width: 1511px) { .year-table-wrap { overflow-x: auto; } .year-table thead th { top: 0; } }
/* Destaque ao passar o mouse: linha inteira e o mês no cabeçalho */
.year-row:hover { --row-bg: #2c3440; }
.year-row:hover td { box-shadow: inset 0 1px 0 #4b5866, inset 0 -1px 0 #4b5866; }
.year-row.annual-section-row.expense:hover td.year-category { box-shadow: inset 3px 0 0 var(--orange), inset 0 1px 0 #4b5866, inset 0 -1px 0 #4b5866; }
.year-row.annual-section-row.income:hover td.year-category { box-shadow: inset 3px 0 0 var(--green), inset 0 1px 0 #4b5866, inset 0 -1px 0 #4b5866; }
.year-row.balance:hover td.year-category { box-shadow: inset 3px 0 0 #4aa3ff, inset 0 1px 0 #4b5866, inset 0 -1px 0 #4b5866; }
.year-row.is-expandable { cursor: pointer; }
.year-table thead th.is-hover-col { background: #34404c; color: #fff; }
.year-table thead th.year-diff-head button { line-height: 1.1; }

/* Categoria aberta: ela e as subcategorias ganham fundo próprio e um filete lateral */
.year-row.year-parent.is-open { --row-bg: #1f3040; }
.year-row.year-parent.is-open td.year-category { box-shadow: inset 3px 0 0 var(--cyan); }
.year-row.year-child { --row-bg: #182633; }
.year-row.year-child:nth-of-type(even) { --row-bg: #1b2a38; }
.year-row.year-child td.year-category { box-shadow: inset 3px 0 0 #25bce966; }
.year-row.year-child:hover { --row-bg: #26394b; }
.year-row.year-child td { border-bottom-color: #233646; }
.year-table thead th.year-diff-head button { white-space: nowrap; font-size: 12px; }

/* Previsto x realizado na tabela anual (botão "Destacar previsto") */
.year-table-tools { display: flex; align-items: center; gap: 14px; margin: 4px 2px 8px; color: var(--muted); font-size: 12px; text-transform: none; }
.forecast-toggle { display: inline-flex; align-items: center; gap: 8px; color: #dfe5ea; font-weight: 600; cursor: pointer; }
.forecast-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.forecast-switch { width: 30px; height: 17px; position: relative; border-radius: 9px; background: #3a414a; transition: background .15s; }
.forecast-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #c9d1d8; transition: transform .15s; }
.forecast-toggle input:checked + .forecast-switch { background: var(--cyan); }
.forecast-toggle input:checked + .forecast-switch::after { transform: translateX(13px); background: #fff; }
.forecast-toggle input:focus-visible + .forecast-switch { outline: 2px solid var(--cyan); outline-offset: 2px; }
.forecast-legend i { color: #7d8893; font-style: normal; }
.forecast-legend b { color: #eef2f5; font-weight: 400; }
.year-table td.year-month.is-forecast { color: #7d8893; }
@media (max-width: 700px) { .year-table-tools { flex-wrap: wrap; } }

/* Compra parcelada */
.installment-preview { margin: -4px 0 0; padding: 8px 10px; border: 1px solid #2f4a5a; border-radius: 4px; background: #162630; color: #bfe3f2; text-transform: none; }

/* Login e estado de gravação no banco */
.auth-pending .app-shell { display: none; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--canvas); text-transform: none; }
.auth-screen[hidden] { display: none; }
.auth-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 18px 50px #0006; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card p { margin: 0 0 12px; line-height: 1.5; }
.auth-card form { display: grid; gap: 12px; }
.auth-card label { display: grid; gap: 6px; font-size: 13px; color: #c9d1d8; }
.auth-card input { min-height: 40px; }
.sync-status { margin-right: 6px; color: var(--muted); font-size: 12px; text-transform: none; white-space: nowrap; }
.sync-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--green); vertical-align: 1px; }
.sync-status.is-saving::before { background: var(--yellow); }
.sync-status.is-error { color: #ffb3b0; }
.sync-status.is-error::before { background: var(--red); }
@media (max-width: 700px) { .sync-status { font-size: 0; margin: 0; } .sync-status::before { margin: 0; } }
.auth-card #authCodeForm { margin: 4px 0 12px; }
.auth-card #authCodeForm input { letter-spacing: .3em; font-size: 18px; text-align: center; }
.auth-card #authEmailCode { font-size: 13px; }
.password-dialog { width: min(440px, calc(100vw - 24px)); }
.password-dialog p { text-transform: none; }

/* Metas com vigência */
.budget-history { margin: 0; color: var(--muted); text-transform: none; }
.manager-money.has-history { text-decoration: underline dotted #6b7884; text-underline-offset: 3px; cursor: help; }
.backup-reminder { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid #6b5a2a; border-radius: 6px; background: #2e2816; color: #f2e3b3; font-size: 13px; text-transform: none; }
.backup-reminder[hidden] { display: none; }
.backup-reminder-actions { display: flex; flex: none; gap: 8px; }
@media (max-width: 700px) { .backup-reminder { flex-direction: column; align-items: stretch; } .backup-reminder-actions .button { flex: 1; } }
#annualTargetLegend { text-transform: none; }

/* Menu da conta: bolinha no canto com e-mail, estado da gravação, senha, backup e sair */
.account-menu { position: relative; flex: none; }
.account-menu[hidden] { display: none; }
.account-avatar { position: relative; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid #4a5560; border-radius: 50%; background: linear-gradient(135deg, #3b4a57, #27313a); color: #eef3f6; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.account-avatar:hover, .account-avatar[aria-expanded="true"] { border-color: var(--cyan); }
.sync-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border: 2px solid #15171b; border-radius: 50%; background: var(--green); }
.sync-dot.is-saving { background: var(--yellow); }
.sync-dot.is-error { background: var(--red); }
.account-panel { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; min-width: 240px; display: grid; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #1e242b; box-shadow: 0 14px 34px #000a; text-transform: none; }
.account-panel[hidden] { display: none; }
.account-info { display: grid; gap: 4px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.account-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.account-panel .sync-status { margin: 0; font-size: 12px; }
.account-panel button { padding: 9px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.account-panel button:hover { background: #2b343d; }
.account-panel button.danger-action { color: var(--red); }
@media (max-width: 700px) { .account-panel .sync-status { font-size: 12px; } .account-panel .sync-status::before { margin-right: 6px; } }

/* Orçamento: ano e Despesas/Entradas na linha do título; botões de criar com o mesmo visual */
.page-title-line { flex-wrap: wrap; row-gap: 8px; }
.page-title-line .category-kind-switch { margin-left: 4px; text-transform: none; }
.page-title-line .category-kind-switch[hidden] { display: none; }
.category-create-button { min-width: 190px; justify-content: center; border-color: #2f6f86; color: #bfeefc; }
.category-create-button:hover { border-color: var(--cyan); background: #17323d; }
.manager-search input { min-width: 260px; }
.manager-sub-count { padding: 3px 9px; border: 1px solid #37424c; border-radius: 12px; background: #222a32; color: #c9d4dc; font: inherit; font-size: 12px; cursor: pointer; text-transform: none; }
.manager-sub-count:hover, .manager-sub-count[aria-expanded="true"] { border-color: var(--cyan); color: #fff; }
.manager-sub-empty { color: var(--muted); font-size: 12px; text-transform: none; }
.manager-table th:nth-child(2), .manager-table td.manager-sub-list { width: 150px; }
/* Orçamento: botões de criar na linha do título, no canto direito */
.page-heading > .category-create-actions { margin-left: auto; text-transform: none; }
.page-heading > .category-create-actions[hidden] { display: none; }
.category-page-heading:not(:has(:not(h2))) { display: none; }
@media (max-width: 700px) { .page-heading > .category-create-actions { width: 100%; } .page-heading > .category-create-actions .button { flex: 1; min-width: 0; } }

/* Caixa de escolha da categoria (sob medida, na largura do campo) */
.combo { position: relative; width: 300px; text-transform: none; }
.combo input { width: 100%; min-width: 0; min-height: 34px; padding: 6px 58px 6px 11px; border: 1px solid #3c424a; border-radius: 6px; background: #191c20; color: var(--ink); font-size: 13px; }
.combo input:focus { border-color: var(--cyan); outline: none; box-shadow: 0 0 0 2px #25bce933; }
.combo-clear, .combo-toggle { position: absolute; top: 50%; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #9aa6b1; transform: translateY(-50%); cursor: pointer; }
.combo-clear { right: 30px; font-size: 16px; }
.combo-toggle { right: 6px; font-size: 13px; }
.combo-clear:hover, .combo-toggle:hover { background: #2b343d; color: #fff; }
.combo-clear[hidden] { display: none; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 300px; margin: 0; padding: 4px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #1e242b; box-shadow: 0 14px 34px #000a; list-style: none; }
.combo-list[hidden] { display: none; }
.combo-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 5px; color: var(--ink); font-size: 13px; cursor: pointer; }
.combo-option:hover, .combo-option.is-active { background: #2b343d; }
.combo-icon { width: 20px; flex: none; text-align: center; }
.combo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-hint { flex: none; max-width: 45%; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.combo-empty { padding: 10px; color: var(--muted); font-size: 13px; }
@media (max-width: 700px) { .combo { width: 100%; } }

/* Diálogos: rótulos, títulos e botões em caixa de frase ("Data do pagamento"), não com
   cada palavra maiúscula. O resto da página segue com o capitalize global. */
dialog .dialog-heading h2, dialog label > span, dialog legend, dialog .button, #managerEditDialog select, #subcategoryDialog select { text-transform: none; }
.budget-history { display: grid; gap: 6px; }
.budget-history-title { color: #c0cdd3; font-size: 13px; font-weight: 650; }
.budget-history-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.budget-history-list li { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; min-height: 30px; padding: 2px 4px 2px 10px; border: 1px solid #33404b; border-radius: 4px; color: var(--muted); font-size: 12px; }
.budget-history-list li.is-current { border-color: #4a6a7c; background: #1b2a34; color: #c9dbe6; }
.budget-history-list strong { color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Confirmação do painel (substitui o confirm do navegador). */
.confirm-dialog { width: min(440px, calc(100vw - 24px)); }
.confirm-dialog form { display: grid; gap: 10px; padding: 22px 22px 18px; text-transform: none; }
.confirm-dialog h2 { margin: 0; font-size: 18px; line-height: 1.3; }
.confirm-dialog p { margin: 0; color: #b9c6cd; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.confirm-dialog .dialog-actions { margin-top: 10px; padding: 0; border: 0; }
.button-danger { border-color: #c2484f; background: #b23a42; color: #fff; }
.button-danger:hover { background: #c4434b; }

/* Arrastar subcategoria para outra categoria. */
.manager-subcategory-row[draggable="true"] { cursor: grab; }
.manager-subcategory-row.dragging { opacity: .45; }
.drag-handle { margin-right: 8px; }
.drag-handle { color: #5d6b76; font-size: 14px; line-height: 1; cursor: grab; user-select: none; }
.manager-subcategory-row:hover .drag-handle { color: #a9b8c2; }
.manager-category-row.drop-target td { background: #1d3442; box-shadow: inset 0 1px 0 #4fb3df, inset 0 -1px 0 #4fb3df; }

/* Editor de meta: lista de vigências + linha para incluir uma nova. */
.budget-editor { display: grid; gap: 8px; padding-top: 4px; text-transform: none; }
.budget-history-empty { margin: 0; color: var(--muted); font-size: 12px; }
.budget-add { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; }
.budget-add .button { height: 40px; white-space: nowrap; }
@media (max-width: 560px) { .budget-add { grid-template-columns: 1fr 1fr; } .budget-add .button { grid-column: 1 / -1; } }

/* Títulos da tabela do Orçamento que ordenam ao clicar. */
.manager-table th .sort-button { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-transform: inherit; cursor: pointer; }
.manager-table th:nth-child(n+3):nth-child(-n+5) .sort-button { flex-direction: row-reverse; }
.sort-arrow { width: 10px; color: #5f6b75; font-size: 9px; }
.sort-button:hover .sort-arrow { color: #a9b6bf; }
.sort-button.active { color: #fff; }
.sort-button.active .sort-arrow { color: var(--cyan); }

/* Planejar o próximo ano. */
.plan-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 14px; padding: 10px 14px; border: 1px solid #2f5566; border-radius: 6px; background: #142630; color: #cfe8f3; font-size: 13px; text-transform: none; }
.plan-banner[hidden] { display: none; }
.plan-dialog { width: min(760px, calc(100vw - 24px)); }
.plan-dialog form { text-transform: none; }
.plan-intro { margin: 0 0 12px; color: #b9c6cd; font-size: 13px; line-height: 1.5; }
.plan-table-scroll { max-height: min(56vh, 520px); overflow: auto; margin: 0; border: 1px solid #33404b; border-radius: 5px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.plan-table th { position: sticky; top: 0; z-index: 1; padding: 8px 10px; background: #26313a; color: #c0cdd3; font-size: 12px; font-weight: 650; text-align: right; }
.plan-table th:first-child { text-align: left; }
.plan-table td { padding: 5px 10px; border-top: 1px solid #2c3842; }
.plan-category .plan-name { color: var(--ink); font-weight: 650; }
.plan-sub .plan-name { padding-left: 22px; color: #aebbc4; }
.plan-money { color: #c9d4dc; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plan-input { width: 130px; }
.plan-input input { width: 100%; height: 30px; padding: 0 8px; border: 1px solid #455563; border-radius: 4px; background: #1a2229; color: var(--ink); text-align: right; font: inherit; }
.plan-input input::placeholder { color: #66737d; }
.plan-dialog #planError { margin: 10px 0 0; }
.manager-money.is-repeated { color: #7d8790; font-style: normal; }
/* Entradas: acima da previsão é positivo. */
.category-metrics article.over.is-income { border-top-color: var(--green, #6fcf4b); }
.category-metrics .over.is-income strong { color: var(--green, #6fcf4b); }
.manager-money.is-ahead { color: var(--green, #6fcf4b); }
.manager-money.is-muted { color: var(--muted); }
