:root {
  color-scheme: dark;
  --bg: #061426;
  --sidebar: #081525;
  --surface: #131f31;
  --surface-2: #17263a;
  --surface-soft: #0c2638;
  --line: #24364d;
  --line-bright: #315069;
  --text: #f7fbff;
  --muted: #8495ac;
  --green: #4fdef2;
  --green-dark: #10394b;
  --red: #ff8290;
  --amber: #ffca5c;
  --shadow: 0 28px 80px rgba(0, 5, 16, .42);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 75% -10%, rgba(32, 105, 139, .18), transparent 30%), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.eyebrow { margin: 0 0 7px; color: var(--green); font-size: .7rem; font-weight: 800; letter-spacing: .06em; }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 28px; border-radius: 17px; color: #041522; background: var(--green); box-shadow: 0 12px 34px rgba(79, 222, 242, .22); font-size: 1.6rem; font-weight: 900; }
.brand-mark.small { width: 42px; height: 42px; margin: 0; border-radius: 13px; font-size: 1.1rem; }
.brand-mark.logo-mark { overflow: hidden; padding: 3px; background: #06111f; }
.brand-mark.logo-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(450px, 100%); padding: 46px; border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(155deg, #14243a, #0a1829); box-shadow: var(--shadow); }
.login-card h1 { margin: 0; font-size: 2.4rem; letter-spacing: -.045em; }
.login-copy { margin: 12px 0 30px; color: var(--muted); line-height: 1.6; }
.password-rule { margin: -4px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.password-change-back { margin-top: 12px; }
.stack { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #c7d3e1; font-size: .83rem; font-weight: 650; }
input, select, textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: #091629; transition: .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(79, 222, 242, .12); }
.button { padding: 11px 17px; border: 1px solid transparent; border-radius: 13px; color: var(--text); background: transparent; font-weight: 760; }
.button.primary { color: #041522; background: var(--green); }
.button.primary:hover { background: #72e8f7; }
.button.compact { padding: 8px 12px; border-radius: 10px; font-size: .68rem; white-space: nowrap; }
.button.danger { border-color: rgba(255, 130, 144, .35); color: #fff; background: #9d3443; }
.button.danger:hover { background: #b84151; }
.button.secondary { border-color: var(--line); background: rgba(255, 255, 255, .025); }
.button.secondary:hover { border-color: var(--line-bright); background: var(--surface-2); }
.wide { width: 100%; padding: 14px; }
.form-error { min-height: 18px; margin: 0; color: #ffa0aa; font-size: .8rem; }
.privacy-note { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; line-height: 1.5; }
.lock-dot, .status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px 1fr; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; display: flex; flex-direction: column; padding: 28px 18px; border-right: 1px solid #1d2d43; background: linear-gradient(180deg, #081525, #071321); }
.brand-row { display: flex; align-items: center; gap: 13px; padding: 0 9px 34px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row strong { font-size: .94rem; }
.brand-row span { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.scope-nav { display: grid; gap: 9px; }
.scope-button { width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid transparent; border-radius: 15px; color: var(--muted); background: transparent; text-align: left; }
.scope-button:hover { background: rgba(255, 255, 255, .025); }
.scope-button.active { color: var(--text); border-color: #2b5c70; background: linear-gradient(120deg, rgba(28, 102, 127, .36), rgba(15, 52, 70, .54)); }
.scope-button strong, .scope-button small { display: block; }
.scope-button strong { font-size: .9rem; }
.scope-button small { margin-top: 3px; color: var(--muted); font-size: .69rem; }
.scope-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: #9fb0c4; background: rgba(255, 255, 255, .04); }
.scope-button.active .scope-icon { color: var(--green); background: rgba(79, 222, 242, .09); }
.sidebar-foot { display: flex; align-items: center; margin-top: auto; padding: 22px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { color: #d9e4ef; }
.sidebar-foot small { margin-top: 4px; }

.workspace { grid-column: 2; min-width: 0; }
.topbar { min-height: 82px; display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(185px, 1fr); align-items: center; gap: 22px; padding: 13px 46px; border-bottom: 1px solid var(--line); background: rgba(6, 20, 38, .86); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 10; }
.topbar-heading { min-width: 0; }
.topbar h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.035em; }
.topbar-period { display: flex; align-items: center; justify-content: center; gap: 22px; }
.period-summary { display: flex; align-items: center; gap: 10px; }
.period-summary strong, .period-summary span { display: block; }
.period-summary strong { font-size: .88rem; white-space: nowrap; }
.period-summary span { margin-top: 3px; color: var(--muted); font-size: .67rem; white-space: nowrap; }
.calendar-chip { width: 36px; height: 36px; display: grid !important; place-items: center; flex: 0 0 auto; margin: 0 !important; border: 1px solid var(--line); border-radius: 11px; color: var(--text) !important; background: var(--surface); font-size: 1rem !important; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.icon-button, .user-button { height: 44px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: var(--surface); }
.icon-button { width: 44px; font-size: 1.2rem; }
.user-button { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; }
.user-button > span:first-child { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #041522; background: var(--green); font-weight: 900; }
.user-button > span:last-child { font-size: .8rem; font-weight: 750; }
.content { max-width: 1520px; margin: 0 auto; padding: 34px 46px 60px; }

.source-banner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 28px; padding: 21px 23px; border: 1px solid #1f455b; border-radius: 19px; background: linear-gradient(110deg, #0c293b, #0d2234); }
.source-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: rgba(79, 222, 242, .09); font-weight: 900; }
.source-banner strong { font-size: .89rem; }
.source-banner p { margin: 5px 0 0; color: #9bb0c4; font-size: .77rem; line-height: 1.45; }
.source-banner > span { color: var(--green); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }

.business-month-tools { display: flex; align-items: end; gap: 10px; }
.business-month-tools label { gap: 5px; font-size: .68rem; }
.business-month-tools input { width: 138px; padding: 8px 10px; }
.automatic-month { padding: 8px 10px; border-radius: 9px; color: var(--green) !important; background: rgba(79, 222, 242, .09); font-size: .64rem !important; font-weight: 850; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metrics.personal-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-card { min-height: 150px; position: relative; overflow: hidden; padding: 24px; border: 1px solid var(--line); border-radius: 21px; background: linear-gradient(145deg, #152238, #111d2f); }
.metric-card::after { content: ""; position: absolute; width: 92px; height: 92px; top: -35px; right: -27px; border-radius: 50%; background: var(--green); opacity: .035; }
.metric-label { color: #9aaac0; font-size: .75rem; font-weight: 700; }
.metric-value { display: block; margin: 19px 0 10px; color: var(--text) !important; font-size: 1.8rem; letter-spacing: -.04em; }
.metric-note { color: var(--muted); font-size: .7rem; line-height: 1.45; }

.panel { padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(21, 34, 55, .98), rgba(16, 29, 47, .98)); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.panel-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.panel h2 { margin: 0; font-size: 1.12rem; }
.expense-filters { display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #0b1729; }
.filter-button { padding: 7px 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .67rem; font-weight: 800; }
.filter-button.active { color: #061624; background: var(--green); }
.empty { min-height: 175px; display: grid; place-items: center; padding: 22px; color: var(--muted); font-size: .79rem; text-align: center; }
.empty strong { display: block; margin-bottom: 7px; color: #e1e9f2; }

.business-expenses-panel { margin-bottom: 20px; }
.month-status { padding: 7px 10px; border-radius: 9px; color: var(--amber); background: rgba(255, 202, 92, .08); font-size: .67rem; font-weight: 850; }
.month-status.created { color: var(--green); background: rgba(79, 222, 242, .09); }
.expense-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.personal-expense-columns, #business-expenses-section .expense-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.accounts-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-scope-card { min-height: 330px; }
.expense-column { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255, 255, 255, .018); }
.personal-category-card { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.personal-category-card > header { flex: 0 0 auto; }
.personal-category-list { min-height: 0; max-height: 350px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--line-bright) transparent; padding-right: 7px; }
.personal-category-list::-webkit-scrollbar { width: 7px; }
.personal-category-list::-webkit-scrollbar-track { background: transparent; }
.personal-category-list::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--line-bright); }
.personal-category-list:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; border-radius: 8px; }
.expense-column > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.expense-column > header > div { display: flex; align-items: center; gap: 10px; }
.expense-column header strong, .expense-column header small { display: block; }
.expense-column header strong { font-size: .82rem; }
.expense-column header small { margin-top: 3px; color: var(--muted); font-size: .63rem; }
.category-pending-total { display: block; margin-top: 7px; color: var(--amber); font-size: .68rem; font-weight: 900; }
.category-pending-total.clear { color: var(--green); }
.expense-symbol { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: rgba(79, 222, 242, .08); font-size: .72rem; font-weight: 900; }
.expense-symbol.payroll { color: #9eb8ff; background: rgba(117, 145, 255, .1); }
.expense-symbol.digital { color: #8be6c1; background: rgba(80, 208, 158, .1); }
.expense-symbol.outings { color: #ff9fbc; background: rgba(255, 110, 155, .1); }
.expense-symbol.loans { color: #c5a7ff; background: rgba(155, 112, 255, .11); }
.expense-symbol.school { color: #8fc5ff; background: rgba(80, 155, 255, .11); }
.expense-symbol.other { color: var(--amber); background: rgba(255, 202, 92, .09); }
.expense-symbol.spending { color: #8be6c1; background: rgba(80, 208, 158, .11); }
.immediate-expense-card { border-color: rgba(80, 208, 158, .22); }
.mini-add { padding: 7px 9px; border: 1px solid var(--line-bright); border-radius: 9px; color: var(--green); background: transparent; font-size: .65rem; font-weight: 800; }
.mini-add:disabled { opacity: .35; cursor: not-allowed; }
.planned-list { display: grid; }
.planned-expense { padding: 14px 0; border-top: 1px solid rgba(41, 61, 86, .72); }
.planned-expense:first-child { border-top: 0; }
.planned-expense-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: start; gap: 8px; }
.concept-line { min-width: 0; display: flex; align-items: flex-start; gap: 7px; flex-wrap: wrap; }
.concept-line > strong { min-width: 0; overflow-wrap: anywhere; }
.expense-action-menu { position: relative; z-index: 1; }
.expense-action-menu[open] { z-index: 30; }
.expense-action-menu summary { width: 25px; height: 23px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; list-style: none; font-size: .7rem; font-weight: 900; letter-spacing: 1px; line-height: 1; }
.expense-action-menu summary::-webkit-details-marker { display: none; }
.expense-action-menu summary:hover, .expense-action-menu[open] summary { border-color: var(--line-bright); color: var(--green); background: rgba(79, 222, 242, .08); }
.expense-action-popover { position: absolute; top: calc(100% + 4px); right: 0; z-index: 31; min-width: 116px; display: grid; gap: 2px; padding: 5px; border: 1px solid var(--line-bright); border-radius: 10px; background: #0b1a2c; box-shadow: 0 14px 32px rgba(0, 0, 0, .38); }
.expense-action-menu.open-upward .expense-action-popover { top: auto; bottom: calc(100% + 4px); }
.expense-action-popover button { width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: .62rem; font-weight: 800; }
.expense-action-edit { color: var(--green); }
.expense-action-edit:hover { background: rgba(79, 222, 242, .1); }
.expense-action-delete { color: #ff9eaa; }
.expense-action-delete:hover { background: rgba(255, 130, 144, .1); }
.planned-expense strong { font-size: .77rem; }
.planned-expense .planned-amount { color: var(--red); font-size: .76rem; font-weight: 850; white-space: nowrap; }
.account-summary-amount { color: var(--green); font-size: .76rem; font-weight: 850; white-space: nowrap; }
.account-summary-amount.negative { color: var(--red); }
.planned-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; color: var(--muted); font-size: .62rem; }
.recurring-badge { padding: 2px 6px; border-radius: 6px; color: var(--green); background: rgba(79, 222, 242, .08); }
.linked-income-badge { padding: 2px 6px; border-radius: 6px; color: #9eb8ff; background: rgba(117, 145, 255, .1); }
.pay-expense { width: 100%; padding: 8px; border: 1px solid var(--line-bright); border-radius: 9px; color: var(--amber); background: rgba(255, 202, 92, .055); font-size: .66rem; font-weight: 800; }
.pay-expense.is-paid { color: var(--green); background: rgba(79, 222, 242, .06); }
.pay-expense:disabled { opacity: 1; cursor: default; }

.personal-category-card .planned-expense { padding: 12px 0; }
.personal-category-card .planned-meta { margin-bottom: 7px; }
.personal-category-card .pay-expense { width: auto; padding: 5px 8px; justify-self: start; font-size: .6rem; }

.calendar-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.calendar-helper { margin: 0; color: var(--muted); font-size: .72rem; }
.calendar-hero label { gap: 5px; font-size: .68rem; }
.calendar-hero input { width: 170px; }
.calendar-hero-actions { display: flex; align-items: end; gap: 10px; }
#finance-notifications-button.active { border-color: rgba(79,222,242,.4); color: var(--green); background: rgba(79,222,242,.08); }
.calendar-metrics { gap: 12px; margin-bottom: 11px; }
.calendar-metrics .metric-card { min-height: 86px; padding: 14px 18px; border-radius: 17px; }
.calendar-metrics .metric-value { margin: 7px 0 3px; font-size: 1.45rem; }
.calendar-legend { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 0 0 9px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--muted); }
.legend-dot.pending { background: var(--amber); }
.legend-dot.paid { background: var(--green); }
.legend-dot.personal { background: #ff9fbc; }
.legend-dot.business { background: #9eb8ff; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, .8fr); align-items: start; gap: 18px; }
.calendar-panel { padding: 12px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.calendar-weekdays { margin-bottom: 7px; }
.calendar-weekdays span { padding: 5px; color: var(--muted); font-size: .64rem; font-weight: 850; text-align: center; text-transform: uppercase; }
.calendar-spacer { min-height: 82px; }
.calendar-day { min-width: 0; min-height: 82px; display: flex; flex-direction: column; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: rgba(255,255,255,.012); text-align: left; }
.calendar-day:hover { border-color: var(--line-bright); background: rgba(79,222,242,.035); }
.calendar-day.selected { border-color: var(--green); box-shadow: 0 0 0 2px rgba(79,222,242,.08); background: rgba(79,222,242,.045); }
.calendar-day.today .calendar-day-number { color: #051623; background: var(--green); }
.calendar-day-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.calendar-day-number { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; font-size: .68rem; font-weight: 900; }
.calendar-day-total { color: var(--muted); font-size: .58rem; font-weight: 800; }
.calendar-day-counts { display: grid; gap: 5px; margin-top: auto; }
.calendar-count { padding: 4px 6px; border-radius: 7px; font-size: .59rem; font-weight: 850; }
.calendar-count.pending { color: var(--amber); background: rgba(255,202,92,.08); }
.calendar-count.paid { color: var(--green); background: rgba(79,222,242,.08); }
.calendar-day-empty { margin-top: auto; color: #50627a; font-size: .57rem; }
.calendar-day-detail { position: sticky; top: 104px; max-height: calc(100vh - 125px); overflow: auto; }
.calendar-day-detail > header { margin-bottom: 10px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.calendar-day-detail h3 { margin: 0; font-size: 1.05rem; }
.calendar-day-detail header p { margin: 6px 0 0; color: var(--muted); font-size: .7rem; }
.calendar-event { padding: 13px 0; border-bottom: 1px solid rgba(41,61,86,.72); }
.calendar-event:last-child { border-bottom: 0; }
.calendar-event-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.calendar-event strong { min-width: 0; font-size: .76rem; overflow-wrap: anywhere; }
.calendar-event-amount { color: var(--red); font-size: .75rem; font-weight: 850; white-space: nowrap; }
.calendar-event-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.calendar-scope, .calendar-status { padding: 3px 6px; border-radius: 6px; font-size: .58rem; font-weight: 850; }
.calendar-scope.personal { color: #ffafd0; background: rgba(255,110,155,.09); }
.calendar-scope.business { color: #b8c9ff; background: rgba(117,145,255,.1); }
.calendar-status.pending { color: var(--amber); background: rgba(255,202,92,.08); }
.calendar-status.paid { color: var(--green); background: rgba(79,222,242,.08); }
.calendar-event-note { color: var(--muted); font-size: .61rem; }

.users-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.users-hero h2 { margin: 0; font-size: 1.65rem; }
.users-hero p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.users-actions { display: flex; gap: 10px; }
.security-callout { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; padding: 20px; border: 1px solid #1f455b; border-radius: 18px; background: #0c293b; }
.security-callout > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--green); background: rgba(79, 222, 242, .09); }
.security-callout strong { font-size: .87rem; }
.security-callout p { margin: 5px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.user-grid { display: grid; gap: 11px; }
.user-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 17px 19px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.user-avatar { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: var(--green); background: rgba(79, 222, 242, .09); font-weight: 850; }
.user-details strong, .user-details span, .user-access span, .user-access small { display: block; }
.user-details strong { font-size: .87rem; }
.user-details span { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.you-badge { display: inline !important; margin-left: 6px; padding: 2px 6px; border-radius: 6px; color: var(--green) !important; background: rgba(79, 222, 242, .08); font-size: .6rem !important; }
.user-access { text-align: right; }
.access-status { color: var(--muted); font-size: .68rem; font-weight: 800; }
.access-status.active { color: var(--green); }
.user-access small { margin-top: 5px; color: var(--muted); font-size: .64rem; }

dialog { width: min(520px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 22px; color: var(--text); background: transparent; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(1, 7, 17, .8); backdrop-filter: blur(6px); }
.dialog-card { display: grid; gap: 16px; padding: 25px; border: 1px solid var(--line); border-radius: 22px; background: #111f32; }
.dialog-card header { display: flex; align-items: start; justify-content: space-between; }
.dialog-card h2 { margin: 0; }
.dialog-close { border: 0; color: var(--muted); background: transparent; font-size: 1.6rem; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { margin: -4px 0 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.delete-warning { margin: 0; color: #c7d3e1; font-size: .85rem; line-height: 1.55; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border: 1px solid var(--line); border-radius: 12px; }
.segmented label { display: block; }
.segmented input { display: none; }
.segmented span { display: block; padding: 9px; border-radius: 8px; color: var(--muted); font-size: .78rem; text-align: center; }
.segmented input:checked + span { color: #061624; background: var(--green); }
.dialog-card label small { color: var(--muted); font-size: .67rem; font-weight: 400; line-height: 1.4; }
.check-row { grid-template-columns: auto 1fr; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.check-row input { width: 17px; height: 17px; margin-top: 2px; }
.check-row span strong, .check-row span small { display: block; }
.check-row span strong { font-size: .78rem; }
.check-row span small { margin-top: 3px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 13px 17px; border: 1px solid #2d6479; border-radius: 12px; color: #e9fcff; background: #0c2a3a; opacity: 0; pointer-events: none; transform: translateY(30px); transition: .25s; font-size: .8rem; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1321px) and (min-height: 720px) {
  .app-shell[data-view="finance"] { height: 100dvh; min-height: 0; overflow: hidden; }
  .app-shell[data-view="finance"] .workspace { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .app-shell[data-view="finance"] .content { width: 100%; height: 100%; min-height: 0; padding: 14px 28px 16px; overflow: hidden; }
  .app-shell[data-view="finance"] #finance-view { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 11px; }
  .app-shell[data-view="finance"] .source-banner { flex: 0 0 auto; margin: 0; padding: 10px 16px; border-radius: 15px; }
  .app-shell[data-view="finance"] .source-icon { width: 31px; height: 31px; }
  .app-shell[data-view="finance"] .source-banner p { margin-top: 2px; line-height: 1.25; }
  .app-shell[data-view="finance"] .metrics { flex: 0 0 auto; gap: 12px; margin: 0; }
  .app-shell[data-view="finance"] .metric-card { min-height: 96px; padding: 15px 18px; border-radius: 17px; }
  .app-shell[data-view="finance"] .metric-value { margin: 8px 0 4px; font-size: 1.45rem; }
  .app-shell[data-view="finance"] .business-expenses-panel { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; margin: 0; padding: 15px; border-radius: 18px; overflow: hidden; }
  .app-shell[data-view="finance"] .panel-head { flex: 0 0 auto; margin-bottom: 10px; }
  .app-shell[data-view="finance"] .panel-head .eyebrow { margin-bottom: 3px; }
  .app-shell[data-view="finance"] .expense-columns { min-height: 0; flex: 1 1 auto; gap: 11px; }
  .app-shell[data-view="finance"] .personal-expense-columns { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .app-shell[data-view="finance"] .expense-column { min-height: 0; display: flex; flex-direction: column; padding: 11px; border-radius: 14px; overflow: hidden; }
  .app-shell[data-view="finance"] .expense-column > header { flex: 0 0 auto; padding-bottom: 8px; }
  .app-shell[data-view="finance"] .personal-category-list,
  .app-shell[data-view="finance"] .expense-column > .planned-list { min-height: 0; max-height: none; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .app-shell[data-view="finance"] .planned-expense,
  .app-shell[data-view="finance"] .personal-category-card .planned-expense { padding: 8px 0; }
  .app-shell[data-view="finance"] .planned-meta { margin: 3px 0 5px; }
  .app-shell[data-view="finance"] .empty { min-height: 100%; padding: 12px; }

  .app-shell[data-view="calendar"] { height: 100dvh; min-height: 0; overflow: hidden; }
  .app-shell[data-view="calendar"] .workspace { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .app-shell[data-view="calendar"] .content { width: 100%; height: 100%; min-height: 0; padding: 12px 28px 16px; overflow: hidden; }
  .app-shell[data-view="calendar"] #calendar-view { height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .app-shell[data-view="calendar"] .calendar-hero,
  .app-shell[data-view="calendar"] .calendar-metrics,
  .app-shell[data-view="calendar"] .calendar-legend { flex: 0 0 auto; }
  .app-shell[data-view="calendar"] .calendar-layout { min-height: 0; flex: 1 1 auto; align-items: stretch; }
  .app-shell[data-view="calendar"] .calendar-panel { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
  .app-shell[data-view="calendar"] .calendar-grid { min-height: 0; flex: 1 1 auto; grid-auto-rows: minmax(55px, 1fr); }
  .app-shell[data-view="calendar"] .calendar-day,
  .app-shell[data-view="calendar"] .calendar-spacer { min-height: 0; }
  .app-shell[data-view="calendar"] .calendar-day-detail { position: static; height: 100%; max-height: none; }

}

@media (max-width: 1320px) {
  .topbar { grid-template-columns: minmax(220px, 1fr) auto; }
  .topbar-period { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }
  .personal-expense-columns, #business-expenses-section .expense-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1120px) {
  .expense-columns, .personal-expense-columns, #business-expenses-section .expense-columns, .accounts-columns { grid-template-columns: 1fr; }
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-day-detail { position: static; max-height: none; }
}

@media (max-width: 980px) {
  .metrics, .metrics.personal-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .app-shell { display: block; padding-bottom: 70px; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 40; width: auto; height: 68px; padding: 6px 7px; border-top: 1px solid var(--line); border-right: 0; background: rgba(7, 19, 33, .96); backdrop-filter: blur(15px); }
  .brand-row, .sidebar-foot { display: none; }
  .scope-nav { height: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
  .scope-button { height: 56px; flex-direction: column; justify-content: center; gap: 1px; padding: 3px 2px; border-radius: 11px; text-align: center; }
  .scope-button > span:last-child { min-width: 0; }
  .scope-button strong { font-size: .58rem; line-height: 1.05; overflow-wrap: anywhere; }
  .scope-button small { display: none; }
  .scope-icon { width: 24px; height: 23px; border-radius: 7px; background: transparent; font-size: .75rem; }
  .workspace { display: block; }
  .topbar { min-height: 58px; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 9px 12px; }
  .topbar .eyebrow { margin-bottom: 2px; font-size: .56rem; }
  .topbar h1 { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-actions { gap: 6px; }
  .icon-button, .user-button { height: 38px; border-radius: 11px; }
  .icon-button { width: 38px; }
  .user-button { padding: 4px; }
  .user-button > span:first-child { width: 28px; height: 28px; }
  .topbar-period { display: none; }
  .content { padding: 11px 9px 18px; }
  .source-banner { grid-template-columns: auto 1fr; gap: 9px; margin-bottom: 10px; padding: 11px; border-radius: 14px; }
  .source-icon { width: 29px; height: 29px; }
  .source-banner strong { font-size: .72rem; }
  .source-banner p { margin-top: 2px; font-size: .61rem; line-height: 1.35; }
  .source-banner > span { display: none; }
  .metrics { display: flex; gap: 8px; margin-bottom: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .metrics::-webkit-scrollbar { display: none; }
  .metric-card { min-width: 158px; min-height: 91px; flex: 0 0 48%; padding: 13px; border-radius: 15px; scroll-snap-align: start; }
  .metric-label { font-size: .63rem; }
  .metric-value { margin: 8px 0 4px; font-size: 1.18rem; }
  .metric-note { font-size: .58rem; }
  .panel { padding: 11px; border-radius: 16px; }
  .panel-head { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 9px; }
  .panel-head .eyebrow { margin-bottom: 2px; }
  .panel h2 { font-size: .95rem; }
  .panel-head-actions { width: 100%; justify-content: space-between; gap: 6px; }
  .expense-filters { flex: 1; }
  .filter-button { flex: 1; padding: 6px 5px; }
  .month-status { padding: 6px 7px; font-size: .56rem; white-space: nowrap; }
  .expense-columns, .personal-expense-columns, #business-expenses-section .expense-columns { gap: 9px; }
  .expense-column { padding: 11px; border-radius: 14px; }
  .expense-column > header { padding-bottom: 9px; }
  .expense-column header strong { font-size: .75rem; }
  .expense-column header small { font-size: .58rem; }
  .category-pending-total { margin-top: 4px; font-size: .61rem; }
  .personal-category-list, .expense-column > .planned-list { max-height: 260px; overflow-y: auto; }
  .empty { min-height: 105px; padding: 12px; font-size: .68rem; }
  .calendar-hero { gap: 8px; margin-bottom: 8px; }
  .calendar-helper { display: none; }
  .calendar-hero-actions { width: 100%; align-items: end; justify-content: space-between; }
  .calendar-hero-actions label { min-width: 0; flex: 1; }
  .calendar-hero-actions input { width: 100%; padding: 9px 10px; }
  #finance-notifications-button { min-height: 38px; padding: 8px 10px; font-size: .65rem; }
  .calendar-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; overflow: visible; scroll-snap-type: none; }
  .calendar-metrics .metric-card { min-width: 0; min-height: 74px; padding: 10px 11px; }
  .calendar-metrics .metric-value { margin: 4px 0 2px; font-size: 1.05rem; }
  .calendar-legend { gap: 9px; margin-bottom: 7px; font-size: .58rem; }
  .calendar-layout { gap: 9px; }
  .calendar-panel { padding: 7px; overflow: visible; }
  .calendar-weekdays, .calendar-grid { min-width: 0; gap: 3px; }
  .calendar-weekdays { margin-bottom: 3px; }
  .calendar-weekdays span { padding: 2px; font-size: .5rem; }
  .calendar-day, .calendar-spacer { min-height: 54px; }
  .calendar-day { gap: 3px; padding: 4px; border-radius: 8px; }
  .calendar-day-number { width: 19px; height: 19px; border-radius: 6px; font-size: .58rem; }
  .calendar-day-total, .calendar-day-empty { display: none; }
  .calendar-day-counts { display: flex; gap: 3px; margin-top: auto; }
  .calendar-count { width: 7px; height: 7px; padding: 0; border-radius: 50%; overflow: hidden; color: transparent !important; font-size: 0; }
  .calendar-day-detail { padding: 14px; }
  .login-card { padding: 34px 26px; }
  .user-button > span:last-child { display: none; }
  .users-hero { align-items: flex-start; }
  .user-card { grid-template-columns: auto 1fr; }
  .user-access { grid-column: 2; display: flex; align-items: center; gap: 8px; text-align: left; }
  .toast { right: 10px; bottom: 78px; left: 10px; text-align: center; }
  dialog { width: 100%; max-width: none; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .dialog-card { max-height: 91dvh; overflow-y: auto; padding: 18px; border-radius: 20px 20px 0 0; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .business-month-tools { width: 100%; align-items: end; }
  .business-month-tools label { flex: 1; }
  .business-month-tools input { width: 100%; }
  .users-actions { width: 100%; flex-direction: column; }
  .users-hero { flex-direction: column; }
  .first-action-card { padding: 24px; }
  .calendar-hero-actions { align-items: stretch; }
}
