.container { max-width: 1200px; }
.auth-card { max-width: 480px; }
.month-picker { width: 180px; }
.card { border-color: #e4e9ef; border-radius: 16px; box-shadow: 0 4px 20px #172b4d04; }
td { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.category-rename { flex: 1 1 180px; max-width: 280px; }
.category-meta { flex: 1 1 180px; }
.category-row:last-child { border-bottom: 0 !important; }
.chart-scroll { overflow-x: auto; }
.report-chart { display: block; height: auto; }
.chart-fit { width: 100%; min-width: 480px; }
#category-chart .report-chart { width: 100%; }
.chart-label { fill: #526174; font: 12px system-ui, sans-serif; }
.chart-grid { stroke: #e5eaf0; stroke-width: 1; }
.chart-income { fill: #138a72; }
.chart-expense { fill: #6374dc; }
.chart-track { fill: #eef0fa; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.income-dot { background: #138a72; }
.expense-dot { background: #6374dc; }

:root { --accent: #187567; --accent-dark: #11594f; --ink: #223749; --surface-muted: #f6f9fa; --line: #e3eaee; }
body.bg-body-tertiary { background: #f2f6f7 !important; color: var(--ink); }
h1 { font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 700; letter-spacing: -.045em; }
h2, h3 { letter-spacing: -.025em; font-weight: 650; }
.h4 { font-size: 1.2rem; }
.eyebrow { color: #6b7f8b; font-size: .72rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.app-header { padding-bottom: 24px; border-bottom: 1px solid #e1e8ed; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 15px; color: #fff; background: var(--accent); }
.brand-mark .bi { width: 25px; height: 25px; }
.bi { display: inline-block; flex-shrink: 0; fill: currentColor; vertical-align: -.125em; }
.btn .bi, .nav-link .bi, .form-label > .bi { margin-right: .5rem; }
.app-nav { display: flex; padding: 7px; background: #e5edef; border: 1px solid #dce6e9; border-radius: 18px; }
.app-nav .nav-link { display: flex; flex: 1 1 0; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; min-width: 0; min-height: 76px; color: #536975; border-radius: 12px; padding: .8rem .4rem; font-size: .8rem; font-weight: 600; line-height: 1.25; transition: background .15s, color .15s, box-shadow .15s; }
.app-nav .nav-link .bi { margin: 0; width: 21px; height: 21px; }
.app-nav .nav-link:hover { background: #f5f8fa; color: var(--accent-dark); }
.app-nav .nav-link.active { background: #fff; color: var(--accent-dark); box-shadow: 0 3px 10px #22374910; }
.stat-card { min-height: 153px; }
.stat-card strong, .report-stat strong { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 37px; height: 37px; border-radius: 11px; }
.stat-icon .bi { width: 19px; height: 19px; }
.stat-income .stat-icon { background: #e7f4ef; color: #187567; }
.stat-expense .stat-icon { background: #eeedfb; color: #6658b5; }
.stat-balance .stat-icon { background: #e9f0fa; color: #3c6fa2; }
.stat-icon-small { width: 28px; height: 28px; border-radius: 8px; }
.stat-icon-small .bi { width: 15px; height: 15px; }
.section-heading { display: flex; align-items: center; gap: .65rem; margin-bottom: 1rem; line-height: 1.4; }
.section-heading > .bi { box-sizing: content-box; color: var(--accent); width: 18px; height: 18px; padding: 9px; background: #edf5f2; border-radius: 10px; }
.form-label { font-size: .85rem; font-weight: 550; color: #526574; }
.form-control, .form-select { border-color: #dce4eb; border-radius: 9px; padding-top: .6rem; padding-bottom: .6rem; }
.form-control:focus, .form-select:focus { border-color: #74aa9f; box-shadow: 0 0 0 .2rem #18756718; }
.btn { border-radius: 9px; font-size: .9rem; font-weight: 550; padding: .6rem .95rem; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-dark); --bs-btn-hover-border-color: var(--accent-dark); --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-border-color: var(--accent-dark); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: #8ab8ad; --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-border-color: var(--accent-dark); }
.btn-outline-secondary { --bs-btn-color: #607281; --bs-btn-border-color: #d5dfe6; }
.table { --bs-table-bg: transparent; --bs-table-border-color: #edf0f4; font-size: .88rem; }
.table th { color: #738391; font-size: .73rem; font-weight: 650; letter-spacing: .035em; text-transform: uppercase; padding-bottom: .9rem; }
.table td { padding-top: .85rem; padding-bottom: .85rem; }
.table .btn, .table td:first-child { white-space: nowrap; }
caption { font-size: .78rem; color: #7c8b97; }
.budget-item strong { font-size: .9rem; font-weight: 600; }
.budget-item p { font-size: .8rem; margin-top: .3rem; }
.budget-progress { display: block; width: 100%; height: 5px; margin-top: .8rem; border: 0; border-radius: 8px; overflow: hidden; background: #edf2f5; accent-color: var(--accent); }
.budget-progress::-webkit-progress-bar { background: #edf2f5; border-radius: 8px; }
.budget-progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
.budget-progress::-moz-progress-bar { background: var(--accent); border-radius: 8px; }
.over-budget { accent-color: #be4c62; }
.over-budget::-webkit-progress-value { background: #be4c62; }
.over-budget::-moz-progress-bar { background: #be4c62; }
#account { font-size: .85rem; color: #607281; }
.admin-user-email { flex: 1 1 240px; overflow-wrap: anywhere; }
.admin-role { width: 170px; }
.import-preview-table { max-height: 560px; }
.import-preview-table thead { position: sticky; top: 0; background: #fff; z-index: 1; }
.import-preview-table input[type="text"], .import-preview-table select { min-width: 155px; }
.bank-text-detail { display: block; margin-top: .3rem; color: #71818e; font-size: .78rem; max-width: 360px; overflow-wrap: anywhere; }
/* Shared layout for every section, including imports and administration. */
.page-header { margin-bottom: 1.75rem; }
.page-title { display: flex; align-items: center; gap: .75rem; margin-bottom: .6rem; font-size: 1.65rem; }
.page-title > .bi { box-sizing: content-box; width: 24px; height: 24px; padding: 12px; border: 1px solid #d7e9e1; border-radius: 14px; color: var(--accent); background: #e8f3ee; }
.page-header > p, .page-header > div > p { max-width: 760px; font-size: .9rem; line-height: 1.65; margin-bottom: 0; }
.overview-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem; }
.card { overflow: hidden; }
.card > .section-heading { margin-bottom: 1.2rem; }
.card .text-secondary { line-height: 1.6; }
.stat-card { position: relative; }
.stat-card::before, .report-stat::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: #bfd6e9; }
.stat-income::before { background: #a3d6c2; }
.stat-expense::before { background: #c5bfeb; }
.report-stat { position: relative; }
.account-explainer { border-left: 3px solid #bad6cc; padding: .15rem 0 .15rem 1rem; line-height: 1.7; margin-bottom: 1.5rem; }
.account-card { border-top: 3px solid #a3d6c2; }
.account-loan { border-top-color: #c5bfeb; }
.account-loan .section-heading > .bi { color: #6658b5; background: #f0edfa; }
.account-archived { background: #f8fafb; border-top-color: #dce4e8; }
.account-balance { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.account-actions { border-top: 1px solid var(--line); padding-top: 1rem; }
.table-responsive { border-radius: 10px; }
.table thead { background: var(--surface-muted); }
.table th:first-child, .table td:first-child { padding-left: .75rem; }
.table th:last-child, .table td:last-child { padding-right: .75rem; }
.table tbody tr:hover { background: #f6faf9; }
.table .bi { width: 13px; height: 13px; margin-right: .35rem; }
.category-row:first-child { padding-top: .25rem !important; }
.category-row:last-child { padding-bottom: .25rem !important; }
.category-meta { font-size: .76rem; }
.admin-user-row:first-child { border-top: 0 !important; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { border-color: #74aa9f; box-shadow: 0 0 0 .2rem #18756718; }
.btn:focus-visible, .nav-link:focus-visible { outline: 3px solid #64a899; outline-offset: 3px; }
.btn-outline-danger { --bs-btn-color: #a94b59; --bs-btn-border-color: #e9d2d7; --bs-btn-hover-bg: #a94b59; --bs-btn-hover-border-color: #a94b59; }
.import-upload { border: 1px dashed #aac6bb; background: #fbfdfc; }
.upload-mark { display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 15px; background: #e8f3ee; color: var(--accent); margin-bottom: 1rem; }
.upload-mark .bi { width: 27px; height: 27px; }
#import-summary, #event-search-totals, #report-period { border-radius: 10px; background: var(--surface-muted); padding: .8rem 1rem; font-size: .85rem; line-height: 1.7; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1.5rem; border: 1px dashed #d8e3e5; border-radius: 12px; background: #f8fbfa; color: #607281; text-align: center; }
.empty-state > .bi { width: 26px; height: 26px; color: #6b9487; }
.empty-state p { margin: 0; font-size: .88rem; line-height: 1.6; }
.origin-create { flex-direction: row; flex-wrap: wrap; align-items: end; gap: 1rem; }
.origin-create > div:first-child { flex: 1 1 260px; }
#recurring-list > article { border: 1px solid var(--line) !important; border-radius: 12px; background: #fbfcfd; padding: 1rem !important; margin-bottom: .8rem; }
#auth, #invitation-accept { margin: 3rem auto; }
@media (max-width: 991.98px) {
  .app-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 359.98px) {
  .app-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-nav .nav-link { flex-direction: row; min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-nav .nav-link { transition: none; }
}
@media (max-width: 575.98px) {
  main.container { padding-top: 1.5rem !important; }
  .brand-mark { width: 43px; height: 43px; border-radius: 12px; }
  .app-nav .nav-link { min-height: 70px; padding: .6rem .2rem; font-size: .73rem; }
  .stat-card { min-height: auto; padding: 1.1rem !important; }
  .stat-card > div { margin-bottom: .4rem !important; }
  #account { display: flex; align-items: center; justify-content: space-between; width: 100%; }
  #email { overflow-wrap: anywhere; min-width: 0; }
  #logout { flex-shrink: 0; }
  .page-title { font-size: 1.4rem; }
  .page-title > .bi { width: 21px; height: 21px; padding: 10px; }
  .card.p-4 { padding: 1.15rem !important; }
  .page-header { margin-bottom: 1.25rem; }
  #report-form { width: 100%; }
  #report-form > div { flex: 1 1 120px; }
  .admin-role, .category-rename { max-width: none; width: 100%; }
  .account-actions .btn { flex: 1 1 auto; }
}

/* Shared budgets reuse the same cards, icon badges and tables as personal views. */
.shared-status { border-left: 3px solid #bad6cc; background: var(--surface-muted); border-radius: 0 10px 10px 0; padding: 1rem; color: #526574; font-size: .85rem; line-height: 1.7; }
.shared-transfer { display: flex; align-items: center; gap: .8rem; border: 1px solid #d7e9e1; border-radius: 10px; padding: 1rem; margin: .75rem 0 0; background: #f3faf6; font-size: .9rem; overflow-wrap: anywhere; }
.shared-transfer .bi { color: var(--accent); }
#shared-member-list span { overflow-wrap: anywhere; min-width: 0; }
@media (min-width: 992px) { .app-nav .nav-link { font-size: .76rem; } }
