html { font-size: 13px; }
body { margin: 0; background: #20252a; color: #cfd6dc; font-family: "Segoe UI", Arial, sans-serif; }
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: #252b31; border: 1px solid #3c4650; padding: 22px; }
.auth-title { margin: 0 0 6px; text-align: center; }
.auth-subtitle { color: #8d9aa5; text-align: center; margin-bottom: 18px; font-size: 13px; }
.auth-form { display: block; }
.auth-field { margin-bottom: 12px; }
.auth-alert { max-width: 380px; width: 100%; margin: 0 auto 12px; }
.app-shell { display: block; min-height: 100vh; }
.app-shell.sidebar-collapsed { display: block; }
.sidebar { position: sticky; top: 0; z-index: 20; width: 100%; background: #171b1f; border-bottom: 1px solid #343b43; padding: 0; overflow: visible; }
.brand-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 0; min-height: 54px; border-bottom: 0; padding: 0 12px; margin: 0; }
.brand { grid-column: 2; color: #e5edf4; font-weight: 700; font-size: 20px; text-align: center; white-space: nowrap; }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; grid-column: 1; grid-row: 1; align-self: stretch; justify-self: stretch; width: auto; height: auto; min-height: 54px; background: transparent; border: 0; color: #d8e3ec; padding: 0; line-height: 1; cursor: pointer; }
.sidebar-toggle:hover { color: #f1f5f8; background: #252d35; border-color: transparent; }
.sidebar-toggle:focus { outline: 1px solid #73a7c8; outline-offset: 2px; }
.sidebar-toggle span { display: block; width: 14px; height: 10px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; position: relative; }
.sidebar-toggle span::before { content: ""; position: absolute; left: 0; right: 0; top: 2px; border-top: 2px solid currentColor; }
.sidebar nav { position: fixed; top: 55px; left: 0; bottom: 0; width: 220px; overflow-y: auto; background: #171b1f; border-right: 1px solid #343b43; padding: 10px; box-shadow: 8px 0 18px rgba(0,0,0,.22); }
.sidebar a { display: flex; align-items: center; gap: 9px; color: #aeb8c2; text-decoration: none; padding: 7px 8px; border: 1px solid transparent; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a:hover { color: #dce8f4; background: #242a30; border-color: #3d4650; }
.nav-group { margin-bottom: 3px; }
.nav-group-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; background: transparent; color: #aeb8c2; border: 1px solid transparent; padding: 7px 8px; text-align: left; transition: background-color .22s ease, border-color .22s ease, color .22s ease; }
.nav-group-toggle:hover { color: #dce8f4; background: #242a30; border-color: #3d4650; }
.nav-group-toggle.active { color: #eef4f8; background: #20262c; border-color: #3d4650; }
.nav-group-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.nav-group-chevron { position: relative; flex: 0 0 10px; width: 10px; height: 10px; }
.nav-group-chevron::before { content: ""; position: absolute; top: 1px; left: 1px; width: 6px; height: 6px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform .26s ease, top .26s ease; }
.nav-group.is-open .nav-group-chevron::before { transform: rotate(225deg); top: 3px; }
.nav-submenu { display: block; max-height: 0; opacity: 0; overflow: hidden; padding: 0 0 0 14px; transition: max-height .28s ease, opacity .2s ease, padding-top .28s ease, padding-bottom .28s ease; }
.nav-group.is-open .nav-submenu { max-height: 112px; opacity: 1; padding: 2px 0 4px 14px; }
.nav-submenu-link { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; padding-left: 24px; font-size: 12px; }
.nav-submenu-link::before { content: ""; position: absolute; left: 10px; top: 50%; width: 5px; height: 5px; margin-top: -3px; border-right: 1px solid #7e8a96; border-bottom: 1px solid #7e8a96; transform: rotate(-45deg); }
.nav-submenu-link.active { color: #eef4f8; background: #20262c; border-color: #3d4650; }
.menu-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; width: 22px; height: 22px; color: #f3f8fc; }
.menu-icon svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.menu-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-shell.sidebar-collapsed .brand { display: block; }
.app-shell.sidebar-collapsed .sidebar nav { display: none; }
.content { min-width: 0; padding: 14px 18px 28px; transition: margin-left .18s ease; }
.app-shell:not(.sidebar-collapsed) .content { margin-left: 220px; }
.page-top { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #3b444d; margin-bottom: 12px; padding-bottom: 8px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-mini { color: #aeb8c2; font-size: 12px; }
.privacy-toggle { background: #252b31; border: 1px solid #4a5560; color: #cfd6dc; font-size: 12px; height: 23px; min-width: 28px; line-height: 1; padding: 2px 6px; }
.privacy-toggle.active { color: #86bddc; border-color: #407f9f; }
.quick-expense { display: inline-flex; align-items: center; gap: 6px; height: 25px; background: #743636; border: 1px solid #995050; color: #f5e7e7; text-decoration: none; padding: 3px 9px; font-size: 12px; line-height: 1; }
.quick-expense:hover { color: #fff; background: #8a4040; border-color: #b76565; }
.quick-expense svg { width: 14px; height: 14px; fill: currentColor; }
h1 { font-size: 20px; margin: 0; font-weight: 600; color: #f1f5f8; }
.breadcrumb-mini { color: #7f8b96; font-size: 12px; }
.toolbar { display: flex; gap: 6px; margin-bottom: 10px; }
.panel { background: #252b31; border: 1px solid #3c4650; padding: 10px; margin-bottom: 12px; }
.panel-title { color: #d9e2ea; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.panel-title-with-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border: 1px solid #46637a; background: #22313e; color: #dce8f4; font-size: 12px; line-height: 1; }
.account-chart-panel { margin-top: 14px; padding: 0; border: 1px solid #3c4650; border-top: 3px solid #3c98d0; background: #20262c; color: #cfd6dc; }
.account-chart-panel .chart-title { color: #86bddc; font-size: 18px; font-weight: 400; padding: 8px 12px; margin: 0; border-bottom: 1px solid #3c4650; }
.account-chart-wrap { height: 390px; padding: 8px 12px 12px; background: #1b2025; overflow: hidden; }
.account-chart-wrap canvas { width: 100%; height: 100%; display: block; }
.monthly-close-panel { margin-top: 12px; }
.monthly-close-summary { display: flex; align-items: stretch; justify-content: space-between; gap: 14px; padding: 10px 12px; margin-bottom: 10px; border: 1px solid #3c4650; background: #1f252b; }
.monthly-close-summary.is-positive { border-color: #45684d; background: #202922; }
.monthly-close-summary.is-negative { border-color: #7a4b4b; background: #241d20; }
.monthly-close-kpi span { display: block; color: #9aa7b2; font-size: 11px; text-transform: uppercase; }
.monthly-close-kpi strong { display: block; margin-top: 4px; font-size: 22px; color: #eef4f8; }
.monthly-close-summary.is-positive .monthly-close-kpi strong { color: #8fd3a3; }
.monthly-close-summary.is-negative .monthly-close-kpi strong { color: #f0a0a0; }
.monthly-close-meta { display: flex; align-items: center; gap: 16px; color: #b3bec8; font-size: 12px; }
.monthly-close-table { margin-top: 0; }
.report-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 10px 12px; align-items: end; }
.report-filter-actions { display: flex; align-items: flex-end; }
.report-kpi-grid { grid-template-columns: repeat(1, minmax(180px, 260px)); margin-bottom: 12px; }
.report-chart-panel { padding: 0; }
.report-chart-panel .panel-title { padding: 10px 12px 0; margin-bottom: 0; }
.report-bar-chart-wrap { height: 430px; padding: 8px 12px 16px; background: #1b2025; overflow: hidden; }
.report-bar-chart-wrap canvas { width: 100%; height: 100%; display: block; }
.report-empty { padding: 14px 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; }
.kpi-grid-dashboard { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.kpi { background: #1d2227; border: 1px solid #3a434c; padding: 8px 10px; }
.kpi.kpi-positive { border-color: #45684d; background: #202922; }
.kpi.kpi-negative { border-color: #7a4b4b; background: #241d20; }
.kpi span { display: block; color: #8d9aa5; font-size: 10px; text-transform: uppercase; }
.kpi strong { display: block; font-size: 18px; margin-top: 3px; color: #f1f5f8; }
.kpi.kpi-positive strong { color: #8fd3a3; }
.kpi.kpi-negative strong { color: #f0a0a0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 9px 12px; }
.form-wide { grid-column: 1 / -1; }
.form-check-line { display: flex; align-items: center; min-height: 30px; }
.form-check-label { display: inline-flex; align-items: center; gap: 8px; color: #d5dde5; font-size: 12px; margin-bottom: 0; }
label { color: #aeb8c2; font-size: 12px; margin-bottom: 3px; }
.field-help { display: block; margin-top: 5px; color: #8d9aa5; font-size: 12px; }
.form-control, .form-select { background: #15191d; color: #e2e8ee; border: 1px solid #4a5560; border-radius: 0; min-height: 30px; padding: 4px 7px; font-size: 13px; }
.form-control:focus, .form-select:focus { background: #15191d; color: #fff; border-color: #73a7c8; box-shadow: none; }
.form-check-input { border-radius: 0; background-color: #15191d; border-color: #4a5560; }
.btn { border-radius: 0; padding: 4px 9px; font-size: 12px; line-height: 1.2; }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-primary { background: #2d5f7d; border-color: #407f9f; }
.btn-secondary { background: #3a434c; border-color: #56616d; color: #edf2f6; }
.btn-danger { background: #743636; border-color: #995050; }
.account-actions .dropdown-toggle { min-width: 84px; }
.dropdown-menu { background: #1b2025; border: 1px solid #3c4650; border-radius: 0; padding: 4px 0; min-width: 140px; box-shadow: 0 8px 18px rgba(0,0,0,.28); }
.dropdown-item { color: #d5dde5; font-size: 12px; padding: 6px 12px; background: transparent; }
.dropdown-item:hover, .dropdown-item:focus { color: #f0f4f7; background: #2b333b; }
.dropdown-item-danger { color: #e7a2a2; }
.dropdown-item-danger:hover, .dropdown-item-danger:focus { color: #ffd7d7; background: #40292c; }
.dropdown-menu form { margin: 0; }
.dropdown-menu button.dropdown-item { width: 100%; border: 0; text-align: left; }
.shopping-grid { display: grid; grid-template-columns: minmax(320px, 430px) minmax(460px, 1fr); gap: 14px; align-items: start; }
.shopping-entry-panel, .shopping-list-panel, .shopping-history-panel { min-width: 0; }
.shopping-entry-form { display: block; }
.shopping-entry-grid { display: grid; grid-template-columns: minmax(120px, 180px) minmax(120px, 180px); gap: 10px 12px; align-items: start; }
.shopping-entry-grid-single { grid-template-columns: minmax(180px, 1fr); }
.shopping-entry-wide { grid-column: 1 / -1; }
.shopping-entry-col { min-width: 0; }
.shopping-entry-notes { min-height: 74px; resize: vertical; }
.shopping-list { list-style: none; margin: 0; padding: 0; }
.shopping-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #343d46; }
.shopping-list li:last-child { border-bottom: 0; }
.todo-sortable-list li { align-items: stretch; }
.todo-drag-handle { position: relative; flex: 0 0 18px; width: 18px; min-height: 28px; margin-top: 1px; cursor: grab; opacity: .85; }
.todo-drag-handle::before,
.todo-drag-handle::after,
.todo-drag-handle span { content: ""; position: absolute; left: 2px; right: 2px; border-top: 2px solid #aeb8c2; }
.todo-drag-handle::before { top: 6px; }
.todo-drag-handle span { top: 11px; }
.todo-drag-handle::after { top: 16px; }
.todo-sortable-list li.is-dragging { opacity: .55; background: #2a3138; }
.todo-sortable-list li:hover .todo-drag-handle { opacity: 1; }
.shopping-item-main { min-width: 0; }
.shopping-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shopping-item-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shopping-item-title { color: #eef4f8; font-weight: 600; }
.shopping-item-title-completed { color: #82c99b; }
.shopping-confirm-title { color: #eef4f8; font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.shopping-item-meta { color: #8d9aa5; font-size: 12px; margin-top: 2px; flex-shrink: 0; }
.shopping-item-meta-completed { color: #92c7a3; }
.shopping-item-notes { color: #aeb8c2; font-size: 12px; margin-top: 4px; white-space: pre-wrap; }
.shopping-item-notes-completed { color: #9fd0ae; }
.shopping-actions { display: flex; gap: 6px; flex-shrink: 0; }
.shopping-empty { color: #87939e; padding: 10px; }
.shopping-history-panel-success { border-color: #45684d; background: linear-gradient(180deg, #273029 0%, #232c26 100%); box-shadow: inset 0 1px 0 rgba(132, 205, 150, .08); }
.shopping-history-title { color: #dff5e4; }
.panel-count-success { border-color: #4f8c61; background: #244231; color: #d8f4df; }
.shopping-complete-badge { display: inline-flex; align-items: center; height: 19px; padding: 0 8px; border: 1px solid #5ea673; background: #244231; color: #dff5e4; font-size: 11px; font-weight: 600; line-height: 1; text-transform: uppercase; letter-spacing: .02em; }
.family-todo-panel { max-width: 720px; }
.family-todo-empty { color: #9ca8b3; padding: 4px 0; }
.table { --bs-table-bg: #20262c; --bs-table-color: #d5dde5; --bs-table-border-color: #3c4650; --bs-table-hover-bg: #2b333b; --bs-table-hover-color: #f0f4f7; color: #d5dde5; margin-bottom: 0; border-color: #3c4650; }
.table > :not(caption) > * > * { background-color: var(--bs-table-bg); color: var(--bs-table-color); border-color: var(--bs-table-border-color); box-shadow: none; }
.table th { --bs-table-bg: #171c21; color: #dce5ec; font-weight: 600; padding: 6px; }
.table td { padding: 5px 6px; vertical-align: middle; }
.table tbody tr:hover > * { background: #2b333b; color: #f0f4f7; }
.attachment-list { display: grid; gap: 8px; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid #3c4650; background: #20262c; }
.attachment-main { min-width: 0; }
.attachment-main a { color: #dce8f4; text-decoration: none; }
.attachment-main a:hover { color: #ffffff; text-decoration: underline; }
.attachment-meta { margin-top: 3px; font-size: 12px; color: #96a4b2; }
.attachment-actions { margin: 0; }
.attachment-badge { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 34px; height: 22px; padding: 0 6px; border: 1px solid #46637a; background: #22313e; color: #dce8f4; font-size: 12px; line-height: 1; }
.attachment-badge-icon { font-size: 12px; line-height: 1; }
.calc-excluded-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid #8a7a4f; background: #3a3421; color: #f2e2a2; font-size: 11px; line-height: 1; text-transform: uppercase; letter-spacing: .02em; }
.text-money { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: #82c99b; }
.neg { color: #e18a8a; }
.muted { color: #87939e; }
.alert-line { border: 1px solid #7a4b4b; background: #2b2020; color: #e0a0a0; padding: 7px 9px; margin-bottom: 10px; }
.alert-line:empty { display: none; }
.field-validation-error { color: #e18a8a; font-size: 12px; }
.field-hint { display: block; margin-top: 5px; color: #8d9aa5; font-size: 12px; }
@media (max-width: 900px) {
  .app-shell,
  .app-shell.sidebar-collapsed { display: block; min-height: 100vh; }
  .sidebar { position: sticky; top: 0; z-index: 20; width: 100%; border-right: 0; border-bottom: 1px solid #343b43; padding: 0; overflow: visible; }
  .brand-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 0; border-bottom: 0; min-height: 48px; margin: 0; padding: 0 8px; }
  .brand { grid-column: 2; text-align: center; font-size: 18px; }
  .sidebar-toggle { grid-column: 1; grid-row: 1; align-self: stretch; justify-self: stretch; width: auto; height: auto; min-height: 48px; border: 0; background: #2f7fa7; color: #f0f7fb; }
  .sidebar-toggle:hover { background: #347f9f; border-color: transparent; }
  .sidebar-toggle span { width: 13px; height: 9px; border-top-width: 2px; border-bottom-width: 2px; }
  .sidebar-toggle span::before { top: 2px; border-top-width: 2px; }
  .sidebar nav { position: fixed; top: 49px; left: 0; bottom: 0; width: 220px; overflow-y: auto; background: #171b1f; border-top: 1px solid #343b43; border-right: 1px solid #343b43; padding: 8px; box-shadow: 8px 0 18px rgba(0,0,0,.22); }
  .app-shell.sidebar-collapsed .brand { display: block; }
  .app-shell.sidebar-collapsed .sidebar nav { display: none; }
  .nav-submenu { padding-left: 10px; }
  .content { min-height: calc(100vh - 49px); padding: 14px 8px 24px; transition: margin-left .18s ease; }
  .app-shell:not(.sidebar-collapsed) .content { margin-left: 220px; }
  .page-top { position: static; align-items: flex-start; gap: 8px; background: transparent; margin: 0 0 12px; padding: 0 0 8px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .kpi-grid, .grid-2, .form-grid, .shopping-grid, .shopping-entry-grid, .report-filter-grid { grid-template-columns: 1fr; }
  .monthly-close-summary, .monthly-close-meta { display: block; }
  .monthly-close-meta span { display: block; margin-top: 6px; }
  .shopping-item-head { display: block; }
}
