/* ============================================================================ */
/* TurboMoneyManager - static\css\app.css */
/* Author: ZioTitanok (v. 2026.08.15) */
/* ============================================================================ */

/*
 * Structure
 * 1. Foundations and application shell
 * 2. Shared components, forms and dialogs
 * 3. Authentication
 * 4. Dashboard and charts
 * 5. Movement archive
 * 6. Accounts and categories
 * 7. Profile and CSV import
 * 8. Reports
 * 9. Responsive rules
 */

/* Shared geometry and components live in turbo-common.css; this file owns the TMM theme and domain UI. */

/* ========================================================================== */
/* 1. Foundations and application shell                                      */
/* ========================================================================== */

:root {
    --brand-color-primary: #8d1e2d;
    --brand-color-primary-rgb: 141, 30, 45;
    --brand-color-primary-dark: #57101a;
    --brand-accent: #d0a22d;
    --brand-deep: #220b0f;
    --brand-ink: #20242a;
    --brand-ink-soft: #3f4650;
    --brand-muted: #69717d;
    --brand-bg: #f1f3f5;
    --brand-surface: #ffffff;
    --brand-line: #d9dee5;
    --brand-danger: #b42318;
    --brand-warning: #b54708;
    --brand-shadow: 0 12px 30px rgba(27, 32, 39, 0.08);
    --brand-shadow-hover: 0 18px 38px rgba(27, 32, 39, 0.13);
    --brand-radius: 0.875rem;
}

.sr-only {
    border: 0;
    clip: rect(0,0,0,0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

html {
    scroll-behavior: smooth;
}

a {
    color: var(--brand-color-primary-dark);
    text-decoration: none;
}

a:hover {
    color: var(--brand-ink);
}

button, summary {
    cursor: pointer;
}

h1, h2, h3, p {
    margin-top: 0;
}

h1 {
    font-size: clamp(2.25rem, 5vw, 3.7rem);
    margin-bottom: .55rem;
}

h2 {
    font-size: 1.22rem;
    margin-bottom: .2rem;
}

small {
    color: var(--brand-muted);
}

.app-navbar {
    background: #3b0b12;
    border-bottom: 1px solid #631521;
}

.navbar-inner {
    gap: 2rem;
}

.app-brand {
    color: #fff;
    flex: 0 0 auto;
}

.app-brand:hover {
    color: #fff;
}

.app-brand small {
    color: #e4e7eb;
}

.desktop-nav {
    align-items: stretch;
    align-self: stretch;
    display: flex;
    gap: .15rem;
}

.desktop-nav > a {
    align-items: center;
    color: #e4e7eb;
    display: flex;
    font-size: .83rem;
    font-weight: 700;
    height: 100%;
    padding: 0 .72rem;
    position: relative;
}

.desktop-nav > a:hover, .desktop-nav > a.active {
    color: #fff;
}

.desktop-nav > a.active::after {
    background: var(--brand-accent);
    border-radius: 99px;
    bottom: 0;
    content: "";
    height: 3px;
    left: .7rem;
    position: absolute;
    right: .7rem;
}

.navbar-actions {
    align-items: center;
    display: flex;
    gap: .5rem;
    margin-left: auto;
}

.navbar-actions form {
    margin: 0;
}

.notification-center {
    position: relative;
}

.notification-center > summary {
    list-style: none;
    position: relative;
}

.notification-center > summary::-webkit-details-marker {
    display: none;
}

.notification-badge {
    align-items: center;
    background: var(--brand-accent);
    border: 2px solid #3b0b12;
    border-radius: 999px;
    color: #231f20;
    display: flex;
    font-size: .62rem;
    font-weight: 800;
    height: 19px;
    justify-content: center;
    min-width: 19px;
    padding: 0 4px;
    position: absolute;
    right: -4px;
    top: -4px;
}

.notification-panel {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: .8rem;
    box-shadow: var(--brand-shadow);
    color: var(--brand-ink);
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: min(390px,calc(100vw - 2rem));
    z-index: 60;
}

.notification-panel-head {
    align-items: center;
    border-bottom: 1px solid var(--brand-line);
    display: flex;
    justify-content: space-between;
    padding: .8rem .9rem;
}

.notification-panel-head strong {
    font-size: .92rem;
}

.notification-dismiss-all {
    background: transparent;
    border: 0;
    color: var(--brand-color-primary);
    font-size: .72rem;
    font-weight: 750;
    padding: .25rem;
}

.notification-item {
    align-items: stretch;
    border-bottom: 1px solid var(--brand-line);
    display: flex;
}

.notification-item > a {
    color: var(--brand-ink-soft);
    display: grid;
    flex: 1;
    gap: .18rem;
    min-width: 0;
    padding: .75rem .35rem .75rem .9rem;
}

.notification-item > a:hover {
    background: #f6f7f9;
    color: var(--brand-ink);
}

.notification-item > a strong {
    color: var(--brand-ink);
    font-size: .8rem;
}

.notification-item > a span {
    font-size: .76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item > a small {
    font-size: .68rem;
}

.notification-dismiss {
    align-items: center;
    align-self: center;
    background: transparent;
    border: 0;
    border-radius: .45rem;
    color: var(--brand-muted);
    display: flex;
    height: 34px;
    justify-content: center;
    margin: .5rem;
    width: 34px;
}

.notification-dismiss:hover {
    background: #fbecea;
    color: var(--brand-danger);
}

.notification-dismiss i {
    font-size: 13px;
    line-height: 1;
    width: 13px;
}

.notification-empty, .notification-more {
    color: var(--brand-muted);
    font-size: .76rem;
    margin: 0;
    padding: 1rem;
    text-align: center;
}

.notification-more {
    border-top: 1px solid var(--brand-line);
    padding: .65rem 1rem;
}

.is-hidden {
    display: none !important;
}

.nav-menu {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: .75rem;
    box-shadow: var(--brand-shadow);
    display: grid;
    gap: .2rem;
    left: 0;
    min-width: 190px;
    padding: .45rem;
    position: absolute;
    top: calc(100% - 4px);
    z-index: 50;
}

.nav-menu-right {
    left: auto;
    right: 0;
    top: calc(100% + 8px);
}

.nav-menu a, .nav-menu button {
    background: transparent;
    border: 0;
    border-radius: .5rem;
    color: var(--brand-ink-soft);
    display: block;
    font-size: .82rem;
    font-weight: 650;
    padding: .6rem .7rem;
    text-align: left;
    width: 100%;
}

.nav-menu a:hover, .nav-menu button:hover {
    background: #eef1f5;
    color: var(--brand-color-primary);
}

.mobile-nav {
    display: none;
    position: relative;
}

.mobile-nav > summary {
    align-items: center;
    border-radius: .45rem;
    color: #fff;
    display: flex;
    height: 40px;
    justify-content: center;
    list-style: none;
    width: 40px;
}

.mobile-nav > summary::-webkit-details-marker {
    display: none;
}

.mobile-nav > summary:hover, .mobile-nav > summary:focus-visible, .mobile-nav[open] > summary {
    background: rgba(255,255,255,.16);
    outline: none;
}

/* ========================================================================== */
/* 2. Shared components, forms and dialogs                                   */
/* ========================================================================== */

.error-page {
    display: grid;
    min-height: calc(100dvh - var(--navbar-height) - 6rem);
    place-items: center;
}

.error-card {
    display: grid;
    justify-items: center;
    width: min(100%, 820px);
    padding: clamp(2rem, 7vw, 5rem);
    text-align: center;
}

.error-card h1 {
    max-width: 720px;
    margin-bottom: 1rem;
}

.error-card > p:not(.eyebrow, .error-code) {
    max-width: 600px;
    margin-bottom: 1.5rem;
    color: var(--brand-muted);
}

.error-code {
    margin: 0 0 0.5rem;
    color: var(--brand-color-primary);
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 900;
    letter-spacing: -0.07em;
    line-height: 0.9;
}

.app-error-page {
    display: grid;
    min-height: calc(100vh - 10rem);
    padding: clamp(1rem, 4vw, 3rem) 0;
    place-items: center;
}

.app-error-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-line);
    border-radius: 1.375rem;
    box-shadow: var(--brand-shadow);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
    max-width: 980px;
    min-height: 430px;
    overflow: hidden;
    width: 100%;
}

.app-error-copy {
    align-content: center;
    display: grid;
    padding: clamp(2rem, 6vw, 4.5rem);
}

.app-error-eyebrow {
    color: var(--brand-color-primary);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    margin: 0 0 .6rem;
    text-transform: uppercase;
}

.app-error-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: -.055em;
    line-height: .98;
    margin: 0;
}

.app-error-message {
    color: var(--brand-muted);
    font-size: clamp(1rem, 2vw, 1.15rem);
    margin: 1.15rem 0 1.75rem;
    max-width: 34rem;
}

.app-error-actions {
    display: flex;
    gap: .5rem;
}

.app-error-actions .btn i {
    font-size: 16px;
    line-height: 1;
    width: 16px;
}

.app-error-visual {
    align-items: center;
    background: var(--brand-deep);
    display: grid;
    justify-items: center;
    margin: 0;
    min-height: 260px;
    overflow: hidden;
}

.app-error-image {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

@media (max-width: 767.98px) {
    .app-error-page {
        min-height: auto;
        padding: 0;
    }

    .app-error-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .app-error-copy {
        padding: 2rem 1.5rem;
    }

    .app-error-visual {
        grid-row: 1;
        min-height: 170px;
    }

    .app-error-image {
        aspect-ratio: 16 / 9;
    }
}

.surface-panel {
    padding: 1.25rem;
}

.page-head > div:first-child {
    max-width: 760px;
}

.transaction-index-actions {
    align-items: center;
    display: flex;
    gap: .5rem;
}

.page-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.category-alpha-sort-button {
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: -.055em;
}

.btn {
    appearance: none;
    border: 1px solid transparent;
    box-sizing: border-box;
    font-weight: 750;
    transition: background-color .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(var(--brand-color-primary-rgb),.16);
    outline: 0;
}

.btn:disabled, .btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: .55;
}

.btn:not(.btn-square):not(.btn-icon):not(.icon-button) {
    align-items: center;
    border-radius: .55rem;
    display: inline-flex;
    justify-content: center;
    min-height: var(--control-size);
    padding: .55rem .9rem;
}

i.btn-icon {
    font-size: 16px;
    line-height: 1;
    text-align: center;
    width: 16px;
}

.btn-primary {
    background: var(--brand-color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-color-primary-dark);
    color: #fff;
}

.btn-ghost {
    background: #fff;
    border-color: #c8ced6;
    color: var(--brand-ink-soft);
}

.btn-ghost:hover {
    border-color: var(--brand-color-primary);
    color: var(--brand-color-primary);
}

.btn-danger {
    background: var(--brand-danger);
    color: #fff;
}

.icon-button {
    background: #fff;
    border-color: var(--brand-line);
    color: var(--brand-ink-soft);
}

.icon-button:hover {
    border-color: var(--brand-color-primary);
    color: var(--brand-color-primary);
}

.nav-action-icon {
    font-size: 17px;
    line-height: 1;
    text-align: center;
    width: 17px;
}

.form-control, .form-select, .field input:not([type="checkbox"]), .field select, .field textarea {
    background: #fff;
    border: 1px solid #c8ced6;
    border-radius: .52rem;
    color: var(--brand-ink);
    min-height: var(--control-size);
    padding: .55rem .7rem;
    width: 100%;
}

.form-control:focus, .form-select:focus, .field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-color-primary-rgb),.13);
    outline: 0;
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

.form-grid.two {
    grid-template-columns: repeat(2, minmax(0,1fr));
}

.field {
    display: grid;
    gap: .35rem;
    min-width: 0;
}

.field > label {
    color: var(--brand-ink-soft);
    font-size: .76rem;
    font-weight: 750;
}

.field small {
    font-size: .7rem;
}

.field .error, .errorlist {
    color: var(--brand-danger);
}

.field.has-error input, .field.has-error select {
    border-color: var(--brand-danger);
}

.form-actions {
    align-items: center;
    display: flex;
    gap: .65rem;
    justify-content: flex-end;
}

.form-actions > a:first-child:not(.btn) {
    margin-right: auto;
}

.save-and-add-button {
    order: 2;
    position: relative;
}

.save-and-add-button > span {
    align-items: center;
    background: var(--brand-color-primary);
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    display: flex;
    font-size: .56rem;
    font-weight: 900;
    height: 16px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 3px;
    top: 3px;
    width: 16px;
}

.transaction-save-button {
    order: 3;
}

.field-disabled {
    opacity: .58;
}

.form-inline-help {
    align-items: center;
    background: #f2f4f7;
    border: 1px solid #d9dee5;
    border-radius: .6rem;
    display: flex;
    font-size: .75rem;
    gap: 1rem;
    justify-content: space-between;
    padding: .7rem .85rem;
}

.form-inline-help a {
    font-weight: 800;
    white-space: nowrap;
}

body.has-open-modal {
    overflow: hidden;
}

.transaction-modal {
    background: transparent;
    border: 0;
    color: var(--brand-ink);
    max-height: calc(100vh - 2rem);
    max-width: none;
    padding: 0;
    width: min(1180px,calc(100vw - 2rem));
}

.transaction-modal::backdrop {
    backdrop-filter: blur(3px);
    background: rgba(18,22,28,.66);
}

.transaction-modal[open] {
    animation: modal-in .18s ease-out;
}

.transaction-modal-content {
    background: var(--brand-surface);
    border: 1px solid var(--brand-line);
    border-radius: 1rem;
    box-shadow: 0 28px 80px rgba(18,22,28,.3);
    display: grid;
    gap: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: clamp(1.1rem,3vw,1.6rem);
}

.account-modal {
    width: min(760px,calc(100vw - 2rem));
}

.account-form-grid {
    grid-template-columns: minmax(0,1fr);
}

.account-identity-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: var(--control-size) minmax(0,1fr);
}

.account-details-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.account-modal [data-field="shared_with"] {
    grid-column: 1 / -1;
}

.account-sharing-field > div {
    background: #f7f8fa;
    border: 1px solid #dce1e7;
    border-radius: .7rem;
    display: grid;
    gap: .2rem;
    max-height: 190px;
    overflow-y: auto;
    padding: .4rem;
}

.account-sharing-field > div > div label {
    align-items: center;
    border-radius: .5rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    display: flex;
    font-size: .76rem;
    gap: .65rem;
    min-height: 42px;
    padding: .45rem .55rem;
}

.account-sharing-field > div > div label:hover {
    background: #e9edf2;
}

.account-sharing-field input[type="checkbox"] {
    accent-color: var(--brand-color-primary);
    flex: 0 0 18px;
    height: 18px;
    margin: 0;
    width: 18px;
}

.account-modal [data-field="color"] input {
    aspect-ratio: 1 / 1;
    height: var(--control-size);
    padding: 3px;
    width: var(--control-size);
}

.account-modal .account-status-field {
    grid-column: 1 / -1;
}

.field-label {
    color: var(--brand-ink-soft);
    font-size: .72rem;
    font-weight: 750;
}

.account-active-toggle {
    align-items: center;
    background: #f7f8fa;
    border: 1px solid #dce1e7;
    border-radius: .7rem;
    cursor: pointer;
    display: flex;
    gap: .65rem;
    min-height: var(--control-size);
    padding: .55rem .7rem;
    width: fit-content;
}

.account-active-toggle:hover {
    border-color: #c4cbd4;
}

.account-active-toggle > span {
    color: var(--brand-muted);
    font-size: .68rem;
    font-weight: 750;
}

.account-active-toggle input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.account-active-toggle > i {
    background: #c8ced6;
    border-radius: 99px;
    display: block;
    height: 24px;
    position: relative;
    transition: .2s;
    width: 44px;
}

.account-active-toggle > i::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(45,21,23,.24);
    content: "";
    height: 18px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: .2s;
    width: 18px;
}

.account-active-toggle input:checked + i {
    background: var(--brand-color-primary);
}

.account-active-toggle input:checked + i::after {
    transform: translateX(20px);
}

.account-active-toggle input:focus-visible + i {
    box-shadow: 0 0 0 3px rgba(var(--brand-color-primary-rgb),.2);
}

.modal-head {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.modal-head h2 {
    font-size: clamp(1.55rem,3vw,2rem);
    margin: 0;
}

.modal-loading {
    color: var(--brand-muted);
    padding: 4rem 1rem;
    text-align: center;
}

.transaction-delete-summary {
    align-items: center;
    background: #f6f7f9;
    border: 1px solid var(--brand-line);
    border-radius: .7rem;
    display: grid;
    gap: .3rem;
    grid-template-columns: 1fr auto;
    padding: .9rem 1rem;
}

.transaction-delete-summary strong {
    font-size: .85rem;
}

.transaction-delete-summary span {
    color: var(--brand-danger);
    font-size: .85rem;
    font-weight: 800;
}

.transaction-delete-summary p {
    color: var(--brand-muted);
    font-size: .75rem;
    grid-column: 1 / -1;
    margin: 0;
}

.transaction-core-grid {
    grid-template-columns: repeat(3,minmax(0,1fr));
}

.movement-common-grid {
    grid-template-columns: minmax(0,1fr);
    width: 100%;
}

.movement-common-grid textarea {
    min-height: var(--control-size);
    resize: vertical;
}

.transaction-transfer-toggle {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: .75rem;
}

.transaction-transfer-toggle {
    background: #f3f5f7;
    border: 1px solid #d7dde4;
    border-radius: .7rem;
    min-height: var(--control-size);
    padding: .65rem .8rem;
}

.transaction-transfer-toggle:hover {
    border-color: #bfc7d1;
}

.transaction-transfer-toggle input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.transaction-transfer-toggle > i {
    background: #c8ced6;
    border-radius: 99px;
    display: block;
    flex: 0 0 44px;
    height: 24px;
    position: relative;
    transition: .2s;
    width: 44px;
}

.transaction-transfer-toggle > i::after {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(45,21,23,.24);
    content: "";
    height: 18px;
    left: 3px;
    position: absolute;
    top: 3px;
    transition: .2s;
    width: 18px;
}

.transaction-transfer-toggle input:checked + i {
    background: var(--brand-color-primary);
}

.transaction-transfer-toggle input:checked + i::after {
    transform: translateX(20px);
}

.transaction-transfer-toggle input:focus-visible + i {
    box-shadow: 0 0 0 3px rgba(var(--brand-color-primary-rgb),.2);
}

.transaction-transfer-toggle span {
    display: grid;
    gap: .1rem;
}

.transaction-transfer-toggle strong {
    font-size: .76rem;
}

.transaction-transfer-toggle small {
    font-size: .62rem;
}

.movement-components, .movement-transfer-fields {
    background: #f5f6f8;
    border: 1px solid #d8dde4;
    border-radius: .75rem;
    display: grid;
    gap: .75rem;
    padding: .8rem;
}

.movement-components[hidden], .movement-transfer-fields[hidden] {
    display: none;
}

.movement-components-head {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.movement-components-head > div:first-child {
    display: grid;
    gap: .12rem;
}

.movement-components-head strong {
    font-size: .78rem;
}

.movement-components-head small {
    font-size: .63rem;
}

.movement-components-actions {
    align-items: center;
    display: flex;
    gap: .65rem;
}

.movement-components-actions output {
    color: var(--brand-muted);
    font-size: .68rem;
    font-weight: 750;
    white-space: nowrap;
}

.movement-component-rows {
    display: grid;
    gap: .6rem;
}

.movement-component-row {
    align-items: end;
    background: #fff;
    border: 1px solid #d8dde4;
    border-radius: .65rem;
    display: grid;
    gap: .65rem;
    padding: .65rem;
}

.movement-component-row .field {
    gap: .28rem;
}

.movement-component-row label {
    font-size: .62rem;
}

.movement-component-main-fields {
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(220px,.8fr) repeat(3,minmax(0,1fr));
    min-width: 0;
}

.movement-amount-control {
    align-items: stretch;
    display: grid;
    gap: .4rem;
    grid-template-columns: 64px minmax(0,1fr);
    min-width: 0;
}

.movement-sign-toggle {
    cursor: pointer;
    display: block;
    height: var(--control-size);
    position: relative;
    width: 64px;
}

.movement-sign-toggle input {
    height: 1px;
    left: 50%;
    opacity: 0;
    position: absolute;
    top: 50%;
    width: 1px;
}

.movement-sign-toggle span {
    align-items: center;
    background: #eef1f5;
    border: 1px solid #c8ced6;
    border-radius: .52rem;
    display: grid;
    grid-template-columns: repeat(2,1fr);
    height: 100%;
    overflow: hidden;
    position: relative;
}

.movement-sign-toggle span::before {
    background: var(--brand-color-primary);
    border-radius: .4rem;
    bottom: 3px;
    box-shadow: 0 2px 6px rgba(45,21,23,.18);
    content: "";
    left: 3px;
    position: absolute;
    top: 3px;
    transition: transform .18s ease;
    width: calc(50% - 3px);
}

.movement-sign-toggle b {
    color: var(--brand-muted);
    font-size: 1rem;
    line-height: 1;
    position: relative;
    text-align: center;
    transition: color .18s ease;
    z-index: 1;
}

.movement-sign-toggle input:not(:checked) + span b:first-child, .movement-sign-toggle input:checked + span b:last-child {
    color: #fff;
}

.movement-sign-toggle input:checked + span::before {
    transform: translateX(100%);
}

.movement-sign-toggle input:focus-visible + span {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-color-primary-rgb),.13);
}

.movement-component-footer-fields {
    align-items: end;
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(0,1fr) var(--control-size);
    min-width: 0;
}

.movement-component-footer-fields .movement-component-remove {
    align-self: end;
}

.movement-component-remove {
    color: var(--brand-danger);
}

.personal-allocation {
    color: var(--brand-muted);
    display: block;
    font-size: .65rem;
    font-weight: 500;
    margin-top: .15rem;
    white-space: nowrap;
}

.movement-allocation {
    align-self: stretch;
    background: #f7f8fa;
    border: 1px solid #d8dde4;
    border-radius: .55rem;
    grid-column: 1 / -1;
}

.movement-allocation[hidden] {
    display: none;
}

.movement-allocation summary {
    align-items: center;
    color: var(--brand-muted);
    cursor: pointer;
    display: flex;
    font-size: .62rem;
    justify-content: space-between;
    list-style: none;
    min-height: 36px;
    padding: .45rem .65rem;
}

.movement-allocation summary::-webkit-details-marker {
    display: none;
}

.movement-allocation summary::after {
    content: "▾";
    font-size: .7rem;
    margin-left: .55rem;
}

.movement-allocation[open] summary::after {
    transform: rotate(180deg);
}

.movement-allocation summary strong {
    color: var(--brand-ink);
    margin-left: auto;
}

.movement-allocation-panel {
    border-top: 1px solid #dde2e8;
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(170px,.35fr) minmax(0,1fr);
    padding: .65rem;
}

.movement-allocation-panel > label {
    display: grid;
    gap: .28rem;
}

.movement-allocation-inputs {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fit,minmax(145px,1fr));
}

.movement-allocation-inputs:empty {
    display: none;
}

.movement-allocation-inputs label {
    display: grid;
    gap: .28rem;
}

.movement-allocation-panel > small {
    color: var(--brand-danger);
    grid-column: 1 / -1;
}

.movement-allocation-panel > small:empty {
    display: none;
}

.movement-allocation-panel > small.is-balanced {
    color: #53665a;
}

.transfer-notes-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }
}

.alert {
    border-radius: .6rem;
    font-size: .8rem;
    padding: .72rem .85rem;
}

.alert.danger {
    background: #fff0ee;
    border: 1px solid #f0c6c1;
    color: #8f241a;
}

.alert.info {
    background: #f2f4f7;
    border: 1px solid #d9dee5;
    color: var(--brand-color-primary-dark);
}

.toast-stack {
    bottom: max(40px,env(safe-area-inset-bottom));
    display: grid;
    gap: .4rem;
    justify-items: center;
    left: 50%;
    pointer-events: none;
    position: fixed;
    transform: translateX(-50%);
    width: min(420px,calc(100vw - 2rem));
    z-index: 1055;
}

.toast {
    animation: toast-in .25s ease;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: .65rem;
    box-shadow: 0 14px 38px rgba(18,22,28,.2);
    font-size: .8rem;
    padding: .8rem 1rem;
    pointer-events: auto;
    text-align: center;
    transition: opacity .25s ease,transform .25s ease;
    width: 100%;
}

.toast.leaving {
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* ========================================================================== */
/* 3. Authentication                                                         */
/* ========================================================================== */

.app-auth-shell a {
    text-decoration: underline;
    text-underline-offset: .18em;
}

.app-auth-brand {
    background: radial-gradient(circle at 20% 15%,rgba(255,255,255,.08),transparent 35%),var(--brand-deep);
}

.app-auth-brand .app-eyebrow {
    color: var(--brand-accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    margin: 0 0 .5rem;
}

.app-auth-copy > p {
    color: #e1e5ea;
    font-size: 1rem;
    margin: 0;
}

.app-auth-card-heading .app-eyebrow, .app-auth-card-heading h2 {
    margin: 0;
}

.app-auth-card-icon {
    background: #eef1f5;
    border: 1px solid rgba(var(--brand-color-primary-rgb),.18);
    color: var(--brand-color-primary);
    font-size: 1.25rem;
    font-weight: 900;
}

.app-auth-card-icon i {
    font-size: 20px;
    line-height: 1;
}

.app-auth-card .field {
    gap: 0;
}

.app-auth-card .field > label,
.app-auth-card .form-label {
    color: var(--brand-ink);
    font-size: .84rem;
    font-weight: 750;
    margin-bottom: .5rem;
}

.app-auth-card .mb-3 {
    margin-bottom: 1rem;
}

.app-auth-actions {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.app-auth-actions .btn {
    align-items: center;
    display: inline-flex;
    gap: .55rem;
    padding: 0;
}

.btn.btn-icon i {
    font-size: 16px;
    line-height: 1;
}

.app-auth-actions.justify-content-end {
    justify-content: flex-end;
}

.app-auth-card .alert.success,
.app-auth-card .alert-success {
    background: #edf7f0;
    border: 1px solid #c5dfcc;
    color: #2f6b3f;
}

.app-auth-card .alert-danger {
    background: #fff0ee;
    border: 1px solid #f0c6c1;
    color: #8f241a;
}

.app-auth-card .alert > p {
    margin: 0;
}

/* ========================================================================== */
/* 4. Dashboard and charts                                                   */
/* ========================================================================== */

.kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4,minmax(0,1fr));
    margin-bottom: 1rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    display: grid;
    gap: .65rem;
    min-height: 120px;
    padding: 1.15rem;
    position: relative;
}

.kpi-card > span {
    color: var(--brand-muted);
    font-size: .75rem;
    font-weight: 700;
}

.kpi-card strong {
    align-self: end;
    font-size: clamp(1.65rem,3vw,2.35rem);
    letter-spacing: -.045em;
}

.kpi-card small {
    align-self: end;
}

.dashboard-income-projection {
    margin-bottom: 1rem;
}

.income-projection-metrics {
    border-bottom: 1px solid var(--brand-line);
    display: grid;
    grid-template-columns: repeat(6,minmax(0,1fr));
    margin: 0 -1rem 1rem;
    padding: 0 1rem 1rem;
}

.income-projection-metrics > div {
    display: grid;
    gap: .35rem;
    min-width: 0;
    padding: .15rem .85rem;
}

.income-projection-metrics > div + div {
    border-left: 1px solid var(--brand-line);
}

.income-projection-metrics span {
    color: var(--brand-muted);
    font-size: .65rem;
    font-weight: 700;
}

.income-projection-metrics strong {
    font-size: clamp(.95rem,1.5vw,1.25rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
}

.income-projection-layout {
    align-items: stretch;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(0,1.45fr) minmax(360px,.75fr);
}

.income-projection-chart {
    min-height: 320px;
    min-width: 0;
}

.income-projection-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .8rem;
    justify-content: center;
    padding: .35rem .5rem 0;
}

.income-projection-legend label {
    align-items: center;
    background: #f5f6f8;
    border: 1px solid var(--brand-line);
    border-radius: .45rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    display: inline-flex;
    font-size: .64rem;
    font-weight: 700;
    gap: .4rem;
    min-height: 32px;
    padding: .3rem .5rem;
}

.income-projection-legend label:hover {
    border-color: #bfc7d1;
}

.income-projection-legend input {
    accent-color: var(--brand-color-primary);
    height: 14px;
    margin: 0;
    width: 14px;
}

.income-projection-legend i {
    display: inline-block;
    flex: 0 0 28px;
    height: 3px;
    width: 28px;
}

.income-line-source-pair {
    background: linear-gradient(90deg,var(--series-color) 0 10px,transparent 10px 26px,color-mix(in srgb,var(--series-color) 38%,transparent) 26px 36px);
    flex-basis: 36px !important;
    position: relative;
    width: 36px !important;
}

.income-line-source-pair::after {
    background: repeating-linear-gradient(90deg,var(--series-color) 0 4px,transparent 4px 7px);
    content: "";
    height: 3px;
    left: 13px;
    position: absolute;
    top: 0;
    width: 10px;
}

.income-source-detail-list {
    display: grid;
    gap: .7rem;
    min-width: 0;
}

.income-source-detail {
    border: 1px solid var(--brand-line);
    border-radius: .7rem;
    display: grid;
    gap: .75rem;
    padding: .85rem;
}

.income-source-detail header {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.income-source-detail header h3 {
    align-items: center;
    display: flex;
    font-size: .78rem;
    gap: .45rem;
    margin: 0;
}

.income-source-detail header h3 i {
    border-radius: 2px;
    display: inline-block;
    height: 11px;
    width: 11px;
}

.income-source-detail header > span {
    color: var(--brand-muted);
    font-size: .68rem;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
}

.income-source-detail-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.income-source-detail-grid > div {
    display: grid;
    gap: .22rem;
    min-width: 0;
    padding: .55rem .45rem;
}

.income-source-detail-grid > div:nth-child(even) {
    border-left: 1px solid var(--brand-line);
}

.income-source-detail-grid > div:nth-child(n/**/+3) {
    border-top: 1px solid var(--brand-line);
}

.income-source-detail-grid span {
    color: var(--brand-muted);
    font-size: .58rem;
    font-weight: 700;
}

.income-source-detail-grid strong {
    font-size: .76rem;
    font-variant-numeric: tabular-nums;
}

.income-source-share-track {
    background: #e7ebef;
    border-radius: 99px;
    display: block;
    height: 4px;
    margin-top: .35rem;
    overflow: hidden;
    width: 100%;
}

.income-source-share-track i {
    display: block;
    height: 100%;
}

.income-projection-empty {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.income-projection-empty p {
    color: var(--brand-muted);
    margin: 0;
}

.negative, .amount.expense {
    color: var(--brand-danger) !important;
}

.positive {
    color: #47704c !important;
}

.amount.income {
    color: #47704c;
}

.amount.transfer {
    color: #655e57;
}

.dashboard-period-picker {
    align-items: center;
    background: #fff;
    border: 1px solid var(--brand-line);
    border-radius: .7rem;
    display: flex;
    gap: .35rem;
    padding: .25rem;
}

.dashboard-period-picker form {
    margin: 0;
}

.dashboard-period-picker .form-select, .dashboard-period-picker .form-control {
    border-color: transparent;
    font-size: .76rem;
    font-weight: 750;
    height: 38px;
    min-height: 38px;
    width: 122px;
}

.dashboard-period-picker .form-control {
    width: 150px;
}

.period-view-switch {
    align-items: center;
    background: #eef1f4;
    border-radius: .5rem;
    display: flex;
    padding: .15rem;
}

.period-view-switch a {
    align-items: center;
    border-radius: .4rem;
    color: var(--brand-muted);
    display: inline-flex;
    font-size: .7rem;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    padding: 0 .65rem;
}

.period-view-switch a.active {
    background: var(--brand-color-primary);
    color: #fff;
}

.dashboard-charts-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: .75rem;
}

.dashboard-charts-grid > .surface-panel {
    margin-bottom: 0;
    min-width: 0;
}

.dashboard-history-panel {
    margin-bottom: .75rem;
    padding-bottom: .5rem;
}

.dashboard-history-panel .panel-head {
    align-items: center;
    margin-bottom: 0;
}

.dashboard-history-head {
    flex-wrap: wrap;
}

.dashboard-chart-range {
    align-items: center;
    display: flex;
    gap: .4rem;
    margin: 0;
}

.dashboard-chart-range label {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    height: 40px;
    min-width: 155px;
    overflow: hidden;
}

.dashboard-chart-range label:focus-within {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-color-primary-rgb),.12);
}

.dashboard-chart-range label span {
    color: var(--brand-muted);
    font-size: .56rem;
    font-weight: 850;
    letter-spacing: .05em;
    padding-left: .6rem;
    text-transform: uppercase;
}

.dashboard-chart-range select {
    background-color: transparent;
    border: 0;
    color: var(--brand-ink);
    font-size: .7rem;
    font-weight: 700;
    min-width: 0;
    outline: 0;
    padding: .35rem 1.6rem .35rem .45rem;
    width: 100%;
}

.dashboard-chart-range .btn {
    height: 40px;
    min-height: 40px;
    min-width: 40px;
    width: 40px;
}

.dashboard-chart-caption {
    color: var(--brand-muted);
    font-size: .68rem;
    font-weight: 700;
    margin-top: .45rem;
    text-align: right;
}

.dashboard-total-chart {
    min-height: 340px;
    padding-inline: .25rem;
}

.dashboard-annual-net-panel {
    margin-bottom: .75rem;
    padding-bottom: .25rem;
}

.dashboard-annual-net-panel .panel-head {
    margin-bottom: 0;
}

.dashboard-annual-net-head {
    align-items: center;
    flex-wrap: wrap;
}

.dashboard-annual-net-chart {
    min-height: 340px;
    padding-inline: .25rem;
}

.dashboard-year-selector {
    position: relative;
    z-index: 7;
}

.dashboard-year-selector summary {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    cursor: pointer;
    display: grid;
    gap: .2rem .55rem;
    grid-template-columns: auto minmax(0,1fr) auto;
    height: 40px;
    list-style: none;
    min-width: 180px;
    padding: .35rem .65rem;
    user-select: none;
}

.dashboard-year-selector summary::-webkit-details-marker {
    display: none;
}

.dashboard-year-selector summary::after {
    color: var(--brand-muted);
    content: "▾";
    font-size: .7rem;
    transition: transform .15s ease;
}

.dashboard-year-selector[open] summary {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-color-primary-rgb),.12);
}

.dashboard-year-selector[open] summary::after {
    transform: rotate(180deg);
}

.dashboard-year-selector summary > span {
    color: var(--brand-muted);
    font-size: .56rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.dashboard-year-selector summary > strong {
    font-size: .7rem;
    font-weight: 750;
}

.dashboard-year-selector-menu {
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .65rem;
    box-shadow: 0 14px 35px rgba(24,29,35,.18);
    min-width: 240px;
    padding: .55rem;
    position: absolute;
    right: 0;
    top: calc(100% + .4rem);
}

.dashboard-year-selector-actions {
    border-bottom: 1px solid var(--brand-line);
    display: flex;
    justify-content: space-between;
    margin-bottom: .35rem;
    padding: .15rem .2rem .45rem;
}

.dashboard-year-selector-actions button {
    background: transparent;
    border: 0;
    color: var(--brand-color-primary);
    cursor: pointer;
    font-size: .65rem;
    font-weight: 800;
    padding: .25rem;
}

.dashboard-year-selector-options {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    max-height: 260px;
    overflow-y: auto;
}

.dashboard-year-selector-options label {
    align-items: center;
    border-radius: .4rem;
    cursor: pointer;
    display: flex;
    font-size: .68rem;
    font-weight: 700;
    gap: .42rem;
    min-height: 34px;
    padding: .35rem .4rem;
}

.dashboard-year-selector-options label:hover {
    background: #f2f4f7;
}

.dashboard-year-selector-options input {
    accent-color: var(--brand-color-primary);
    height: 14px;
    margin: 0;
    width: 14px;
}

.dashboard-year-selector-options i {
    display: block;
    flex: 0 0 22px;
    height: 3px;
    width: 22px;
}

.dashboard-year-selector-options i.line-solid {
    background: var(--series-color);
}

.dashboard-year-selector-options i.line-dashed {
    background: repeating-linear-gradient(90deg,var(--series-color) 0 7px,transparent 7px 11px);
}

.dashboard-year-selector-options i.line-dotted {
    background: repeating-linear-gradient(90deg,var(--series-color) 0 2px,transparent 2px 6px);
}

.dashboard-year-selector-options i.line-dash-dot {
    background: repeating-linear-gradient(90deg,var(--series-color) 0 8px,transparent 8px 11px,var(--series-color) 11px 13px,transparent 13px 17px);
}

.dashboard-period-toolbar {
    align-items: center;
    background: #e9edf2;
    border: 1px solid #d5dbe2;
    border-radius: var(--brand-radius);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: .65rem .75rem .65rem 1rem;
}

.dashboard-period-description {
    display: grid;
    line-height: 1.2;
}

.dashboard-period-description span {
    color: var(--brand-muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.dashboard-period-description strong {
    font-size: .84rem;
    margin-top: .16rem;
}

.dashboard-summary-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.dashboard-period-caption {
    color: var(--brand-muted);
    font-size: .68rem;
    font-weight: 700;
    margin: -.55rem 0 1rem;
}

.category-breakdown-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.category-breakdown + .category-breakdown {
    border-left: 1px solid var(--brand-line);
    padding-left: 1.25rem;
}

.category-breakdown h3 {
    font-size: .9rem;
    margin: 0 0 .9rem;
}

.dashboard-category-history {
    margin-top: 1rem;
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

.dashboard-category-history-head {
    align-items: center;
    border-bottom: 1px solid var(--brand-line);
    margin: 0;
    padding: 1rem 1.1rem;
}

.dashboard-category-history-filter {
    align-items: center;
    display: flex;
    gap: .65rem;
}

.dashboard-category-history-filter > span {
    color: var(--brand-muted);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.dashboard-category-history-filter select {
    min-width: 260px;
}

.dashboard-category-stack-chart {
    min-height: 320px;
    padding: 1rem 1rem .25rem;
}

.dashboard-category-stack-chart canvas {
    display: block;
    max-width: 100%;
}

.dashboard-category-stack-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .55rem;
    padding: .65rem 1.1rem 1rem;
}

.dashboard-category-stack-legend > span {
    align-items: center;
    background: #f5f6f8;
    border: 1px solid #dde2e8;
    border-radius: .45rem;
    color: var(--brand-ink-soft);
    display: inline-flex;
    font-size: .64rem;
    font-weight: 700;
    gap: .4rem;
    min-height: 30px;
    padding: .28rem .5rem;
}

.dashboard-category-stack-legend i {
    background: var(--series-color);
    border-radius: 2px;
    display: block;
    height: 10px;
    width: 10px;
}

.dashboard-category-history-table-wrap {
    border-top: 1px solid var(--brand-line);
    overflow: auto;
}

.dashboard-category-history-table {
    min-width: max-content;
    table-layout: auto;
}

.dashboard-category-history-table th:first-child {
    min-width: 92px;
}

.dashboard-category-history-table th:not(:first-child), .dashboard-category-history-table td {
    min-width: 112px;
}

.panel-head {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-head h2 {
    margin: 0;
}

.panel-head > a {
    font-size: .75rem;
    font-weight: 750;
}

.progress-list {
    display: grid;
    gap: .8rem;
}

.progress-row > div:first-child {
    align-items: center;
    display: flex;
    font-size: .74rem;
    justify-content: space-between;
    margin-bottom: .3rem;
}

.progress-row span {
    align-items: center;
    display: inline-flex;
}

.progress-row i, .account-mini-list i, .category-pill i {
    border-radius: 50%;
    display: inline-block;
    height: 8px;
    margin-right: .4rem;
    width: 8px;
}

.progress-row strong {
    font-size: .75rem;
}

.progress-track {
    background: #e4e8ed;
    border-radius: 99px;
    height: 7px;
    overflow: hidden;
}

.progress-track span {
    background: var(--brand-color-primary);
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width .25s ease;
}

.account-mini-list {
    display: grid;
    gap: .1rem;
}

.account-mini-list > div {
    align-items: center;
    border-bottom: 1px solid #e3e7ec;
    display: flex;
    font-size: .78rem;
    justify-content: space-between;
    padding: .65rem 0;
}

.account-mini-list > div:last-child {
    border: 0;
}

.account-mini-balance {
    font-weight: 400;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    border-collapse: collapse;
    min-width: 760px;
    width: 100%;
}

.data-table.wide {
    min-width: 1000px;
}

.data-table th {
    background: #f4f6f8;
    color: var(--brand-muted);
    font-size: .67rem;
    letter-spacing: .045em;
    padding: .65rem .85rem;
    text-align: left;
    text-transform: uppercase;
}

.data-table td {
    border-top: 1px solid #e3e7ec;
    font-size: .76rem;
    padding: .7rem .85rem;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f7f8fa;
}

.data-table td strong {
    display: block;
}

.data-table td small {
    display: block;
    font-size: .64rem;
    margin-top: .12rem;
}

.data-table .number {
    text-align: right;
    white-space: nowrap;
}

.row-actions {
    text-align: right;
    white-space: nowrap;
}

.row-actions a {
    align-items: center;
    display: inline-flex;
    justify-content: center;
}

.row-action-form {
    display: inline-flex;
    margin: 0;
    vertical-align: middle;
}

.row-actions .table-action {
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    color: var(--brand-color-primary);
    height: var(--control-size);
    margin-left: .3rem;
    min-height: var(--control-size);
    min-width: var(--control-size);
    padding: 0;
    width: var(--control-size);
}

.row-actions .table-action:hover {
    background: #eef1f5;
    border-color: var(--brand-color-primary);
    color: var(--brand-color-primary-dark);
}

.row-actions .table-action-danger {
    color: var(--brand-danger);
}

.row-actions .table-action-danger:hover {
    background: #fff0ee;
    border-color: var(--brand-danger);
    color: var(--brand-danger);
}

.category-pill {
    align-items: center;
    background: #eef1f4;
    border-radius: 99px;
    display: inline-flex;
    font-size: .67rem;
    padding: .3rem .55rem;
    white-space: nowrap;
}

/* ========================================================================== */
/* 5. Movement archive                                                       */
/* ========================================================================== */

.transactions-table {
    min-width: 1300px;
    table-layout: fixed;
}

.transactions-table .transaction-date-column {
    width: 215px;
}

.transactions-table .transaction-year-column {
    width: 145px;
}

.transactions-table .transaction-account-column {
    width: 180px;
}

.transactions-table .transaction-amount-column {
    width: 130px;
}

.transactions-table .transaction-category-column {
    width: 170px;
}

.transactions-table .transaction-subcategory-column {
    width: 190px;
}

.transactions-table .transaction-actions-column {
    width: 96px;
}

.transactions-table .column-filters th {
    background: #f6f7f9;
    border-bottom: 1px solid #d9dee5;
    padding: .65rem .5rem;
    vertical-align: middle;
}

.transactions-table .column-filters th:first-child {
    padding-left: .75rem;
}

.transactions-table .column-filters th:last-child {
    padding-right: .75rem;
}

.table-filter-control {
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    color: var(--brand-ink);
    font-size: .71rem;
    font-weight: 650;
    letter-spacing: normal;
    min-height: 40px;
    padding: .42rem .6rem;
    text-transform: none;
    width: 100%;
}

.table-filter-control:focus {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-color-primary-rgb),.12);
    outline: 0;
}

.year-multiselect {
    position: relative;
}

.year-multiselect summary {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    color: var(--brand-ink);
    display: flex;
    font-size: .71rem;
    font-weight: 650;
    justify-content: space-between;
    min-height: 40px;
    padding: .42rem .6rem;
    text-transform: none;
}

.year-multiselect summary::after {
    border-bottom: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    content: "";
    margin-left: .4rem;
}

.year-multiselect[open] summary {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-color-primary-rgb),.12);
}

.year-multiselect-options {
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    box-shadow: var(--brand-shadow);
    display: grid;
    gap: .15rem;
    left: 0;
    max-height: 230px;
    min-width: 150px;
    overflow-y: auto;
    padding: .4rem;
    position: absolute;
    top: calc(100% + .35rem);
    z-index: 40;
}

.year-multiselect-options label {
    align-items: center;
    border-radius: .4rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    display: flex;
    font-size: .72rem;
    gap: .45rem;
    padding: .4rem .45rem;
    text-transform: none;
}

.year-multiselect-options label:hover {
    background: #eef1f5;
}

.year-multiselect-options input {
    accent-color: var(--brand-color-primary);
    height: 15px;
    margin: 0;
    width: 15px;
}

.filter-multiselect {
    position: relative;
}

.filter-multiselect summary {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .55rem;
    color: var(--brand-ink);
    display: flex;
    font-size: .71rem;
    font-weight: 650;
    justify-content: space-between;
    list-style: none;
    min-height: 40px;
    padding: .42rem .6rem;
    text-transform: none;
}

.filter-multiselect summary::-webkit-details-marker {
    display: none;
}

.filter-multiselect summary::after {
    border-bottom: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    content: "";
    margin-left: .4rem;
}

.filter-multiselect[open] summary {
    border-color: var(--brand-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-color-primary-rgb),.12);
}

.filter-multiselect.is-disabled summary {
    background: #e8ebef;
    color: #89919c;
    cursor: not-allowed;
}

.filter-multiselect-options {
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .6rem;
    box-shadow: var(--brand-shadow);
    display: grid;
    gap: .12rem;
    left: 0;
    max-height: 260px;
    min-width: 220px;
    overflow-y: auto;
    padding: .4rem;
    position: absolute;
    top: calc(100% + .35rem);
    z-index: 40;
}

.filter-multiselect-options label {
    align-items: center;
    border-radius: .4rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    display: flex;
    font-size: .72rem;
    gap: .45rem;
    padding: .4rem .45rem;
    text-transform: none;
}

.filter-multiselect-options label:hover {
    background: #eef1f5;
}

.filter-multiselect-options input {
    accent-color: var(--brand-color-primary);
    height: 15px;
    margin: 0;
    width: 15px;
}

.subcategory-multiselect-options {
    min-width: 280px;
}

.subcategory-filter-group {
    display: grid;
    gap: .1rem;
}

.subcategory-filter-group[hidden] {
    display: none;
}

.subcategory-filter-group + .subcategory-filter-group {
    border-top: 1px solid var(--brand-line);
    margin-top: .35rem;
    padding-top: .4rem;
}

.subcategory-filter-group > strong {
    color: var(--brand-color-primary-dark);
    font-size: .62rem;
    letter-spacing: .055em;
    padding: .22rem .45rem;
    text-transform: uppercase;
}

.filter-empty-option {
    color: var(--brand-muted);
    font-size: .7rem;
    padding: .45rem;
    text-transform: none;
}

.transaction-year {
    color: var(--brand-muted);
    font-weight: 750;
}

.transaction-date-main {
    align-items: center;
    display: flex;
    gap: .35rem;
}

.transaction-drag-handle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: .42rem;
    color: #7c858f;
    cursor: grab;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    padding: 0;
    touch-action: none;
    width: 30px;
}

.transaction-drag-handle:hover, .transaction-drag-handle:focus-visible {
    background: #eef1f5;
    color: var(--brand-color-primary);
    outline: none;
}

.transaction-drag-handle:active {
    cursor: grabbing;
}

.transaction-drag-handle .btn-icon {
    font-size: 15px;
    width: 15px;
}

.transaction-drag-spacer {
    flex: 0 0 30px;
    width: 30px;
}

.transaction-date-cell .movement-group-label {
    margin-left: 34px;
}

.transactions-table tr.is-dragging > td {
    background: #f3f5f8 !important;
    opacity: .55;
}

.transactions-table tr.is-drag-over-before > td {
    box-shadow: inset 0 2px var(--brand-color-primary);
}

.transactions-table tr.is-drag-over-after > td {
    box-shadow: inset 0 -2px var(--brand-color-primary);
}

.transactions-table tbody.is-saving-order .transaction-drag-handle {
    cursor: wait;
    pointer-events: none;
}

.column-filter-actions {
    align-items: center;
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
    min-width: 0;
}

.column-filter-actions .btn {
    flex-basis: 40px;
    height: 40px;
    max-height: 40px;
    max-width: 40px;
    min-height: 40px;
    min-width: 40px;
    width: 40px;
}

.transactions-table tbody td {
    height: 58px;
    padding: .65rem .9rem;
}

.transactions-table tbody td:first-child {
    padding-left: 1rem;
}

.transactions-table tbody td:last-child {
    padding-right: 1rem;
}

.transactions-table .row-actions .table-action {
    border-color: transparent;
    border-radius: .5rem;
    height: 34px;
    margin-left: .2rem;
    min-height: 34px;
    min-width: 34px;
    width: 34px;
}

.transactions-table .row-actions .table-action:not(.table-action-danger) {
    background: #eef1f5;
}

.transactions-table .row-actions .table-action-danger {
    background: #fff2ef;
}

.transactions-table .row-actions .btn-icon {
    font-size: 14px;
    width: 14px;
}

.transaction-lazy-row > td {
    background: #f7f8fa;
    padding: .75rem !important;
    text-align: center;
}

.transaction-lazy-row button {
    background: transparent;
    border: 0;
    color: var(--brand-color-primary);
    font-size: .7rem;
    font-weight: 800;
    min-height: 36px;
    padding: .4rem 1rem;
}

.transaction-lazy-row button:hover, .transaction-lazy-row button:focus-visible {
    color: var(--brand-color-primary-dark);
    outline: none;
    text-decoration: underline;
}

.transaction-lazy-row.is-loading button {
    color: var(--brand-muted);
    cursor: wait;
}

.transaction-lazy-row.is-loading button::after {
    content: "…";
}

.transaction-note {
    max-width: 340px;
    min-width: 210px;
    overflow-wrap: anywhere;
    white-space: normal;
}

.transactions-table .movement-group-row > td {
    background: #fafbfc;
}

.transactions-table .movement-group-row > td:first-child {
    box-shadow: inset 3px 0 #a9b1bc;
}

.transactions-table .movement-group-start > td {
    border-top: 2px solid #cbd1d8;
}

.movement-group-label {
    color: var(--brand-muted);
    display: block;
    font-size: .56rem;
    font-weight: 750;
    margin-top: .12rem;
}

.empty {
    color: var(--brand-muted);
    font-size: .78rem;
    padding: 1.2rem 0;
    text-align: center;
}

/* ========================================================================== */
/* 6. Accounts and categories                                                */
/* ========================================================================== */

.accounts-table {
    min-width: 940px;
}

.accounts-table .account-name {
    display: inline-block;
}

.account-transaction-link {
    border-radius: .35rem;
    color: inherit;
    display: inline-block;
    margin: -.25rem;
    padding: .25rem;
}

.account-transaction-link:hover .account-name, .account-transaction-link:focus-visible .account-name {
    color: var(--brand-color-primary);
    text-decoration: underline;
    text-underline-offset: .16em;
}

.account-transaction-link:focus-visible {
    outline: 2px solid rgba(var(--brand-color-primary-rgb),.22);
    outline-offset: 1px;
}

.accounts-table .account-color-cell {
    width: 106px;
}

.account-color-tools {
    align-items: center;
    display: flex;
    gap: .35rem;
}

.account-drag-handle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: .45rem;
    color: #7c858f;
    cursor: grab;
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    padding: 0;
    touch-action: none;
    width: 36px;
}

.account-drag-handle:hover, .account-drag-handle:focus-visible {
    background: #eef1f5;
    color: var(--brand-color-primary);
    outline: none;
}

.account-drag-handle:active {
    cursor: grabbing;
}

.accounts-table tr.is-dragging > td {
    background: #f3f5f8;
    opacity: .55;
}

.accounts-table tr.is-drag-over > td {
    box-shadow: inset 0 2px var(--brand-color-primary);
}

[data-account-reorder-list].is-saving .account-drag-handle {
    cursor: wait;
    pointer-events: none;
}

.account-color-form {
    display: inline-flex;
    margin: 0;
}

.account-color-input {
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 1px solid #c8ced6;
    border-radius: .5rem;
    cursor: pointer;
    flex: 0 0 40px;
    height: 40px;
    padding: 3px;
    width: 40px;
}

.account-color-input:hover, .account-color-input:focus-visible {
    border-color: var(--brand-color-primary);
    outline: 2px solid rgba(var(--brand-color-primary-rgb),.12);
}

.account-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.account-color-input::-webkit-color-swatch {
    border: 0;
    border-radius: .25rem;
}

.account-color-input::-moz-color-swatch {
    border: 0;
    border-radius: .25rem;
}

.account-color-swatch {
    aspect-ratio: 1 / 1;
    border: 3px solid #fff;
    border-radius: .5rem;
    box-shadow: 0 0 0 1px #c8ced6;
    display: inline-block;
    height: 40px;
    width: 40px;
}

.accounts-table .account-balance {
    color: var(--brand-ink);
    font-size: .88rem;
    font-weight: 400;
}

.account-row-actions {
    align-items: center;
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
    min-height: var(--control-size);
}

.account-row-actions .row-action-form {
    align-items: center;
}

.accounts-table .account-row-actions .table-action {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    margin-left: 0;
    vertical-align: middle;
}

.accounts-table .account-row-actions .btn-icon {
    display: block;
    flex: 0 0 16px;
}

.accounts-table tr.is-archived > td {
    color: var(--brand-muted);
    opacity: .65;
}

.accounts-table tr.is-archived:hover > td {
    opacity: .82;
}

.accounts-table .shared-lock {
    color: var(--brand-muted);
    display: inline-block;
    min-width: 28px;
    text-align: center;
}

.status-pill {
    background: #eceff3;
    border-radius: 99px;
    color: var(--brand-muted);
    font-size: .62rem;
    font-weight: 750;
    padding: .28rem .5rem;
}

.status-pill.active {
    background: #e6e9ee;
    color: var(--brand-color-primary-dark);
}

.category-table {
    min-width: 710px;
    table-layout: fixed;
}

.category-color-column {
    width: 72px;
}

.category-visibility-column {
    width: 180px;
}

.category-actions-column {
    width: 156px;
}

.category-table td {
    height: 62px;
    padding-bottom: .65rem;
    padding-top: .65rem;
    vertical-align: middle;
}

.category-table-group + .category-table-group .category-root-row > td {
    border-top: 9px solid var(--brand-bg);
}

.category-root-row > td {
    background: #f4f6f8;
}

.category-root-row > td:first-child {
    box-shadow: inset 4px 0 var(--category-color);
}

.category-identity-cell strong, .category-identity-cell small {
    display: block;
}

.category-identity-cell strong {
    color: var(--brand-ink);
    font-size: .84rem;
    line-height: 1.25;
}

.category-identity-cell small {
    font-size: .64rem;
    margin-top: .18rem;
}

.category-transaction-link {
    border-radius: .35rem;
    color: inherit;
    display: block;
    margin: -.25rem;
    padding: .25rem;
    width: fit-content;
}

.category-transaction-link:hover strong, .category-transaction-link:focus-visible strong {
    color: var(--brand-color-primary);
    text-decoration: underline;
    text-underline-offset: .16em;
}

.category-transaction-link:focus-visible {
    outline: 2px solid rgba(var(--brand-color-primary-rgb),.22);
    outline-offset: 1px;
}

.category-child-row .category-identity-cell {
    position: relative;
}

.subcategory-identity {
    padding-left: 2.5rem !important;
}

.subcategory-identity::before {
    border-bottom: 1px solid #c9d0d8;
    border-left: 1px solid #c9d0d8;
    border-radius: 0 0 0 .35rem;
    content: "";
    height: 25px;
    left: 1rem;
    position: absolute;
    top: 0;
    width: .9rem;
}

.category-color-form, .category-visibility-cell form {
    align-items: center;
    display: inline-flex;
    justify-content: center;
    margin: 0;
}

.category-color-input {
    aspect-ratio: 1 / 1;
    background: #fff;
    border: 1px solid #c8ced6;
    border-radius: .5rem;
    cursor: pointer;
    flex: 0 0 38px;
    height: 38px;
    padding: 3px;
    width: 38px;
}

.category-color-input:hover, .category-color-input:focus-visible {
    border-color: var(--brand-color-primary);
    outline: 2px solid rgba(var(--brand-color-primary-rgb),.12);
}

.category-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.category-color-input::-webkit-color-swatch {
    border: 0;
    border-radius: .25rem;
}

.category-color-input::-moz-color-swatch {
    border: 0;
    border-radius: .25rem;
}

.category-color-swatch {
    aspect-ratio: 1 / 1;
    border: 3px solid #fff;
    border-radius: .5rem;
    box-shadow: 0 0 0 1px #c8ced6;
    display: inline-block;
    height: 38px;
    width: 38px;
}

.category-color-cell {
    padding-left: 1rem !important;
    width: 72px;
}

.category-drag-handle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: .45rem;
    color: #7c858f;
    cursor: grab;
    display: inline-flex;
    height: 36px;
    justify-content: center;
    margin-left: 3px;
    padding: 0;
    touch-action: none;
    width: 36px;
}

.category-drag-handle:hover, .category-drag-handle:focus-visible {
    background: #eef1f5;
    color: var(--brand-color-primary);
    outline: none;
}

.category-drag-handle:active {
    cursor: grabbing;
}

.category-child-row.is-dragging > td {
    background: #f3f5f8;
    opacity: .55;
}

.category-child-row.is-drag-over > td {
    box-shadow: inset 0 2px var(--brand-color-primary);
}

.category-table-group.is-saving .category-drag-handle {
    cursor: wait;
    pointer-events: none;
}

.category-visibility-cell {
    text-align: center;
}

.category-table .row-actions {
    min-width: 112px;
    padding-right: 1rem;
}

.category-row-actions {
    align-items: center;
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
    min-height: 36px;
}

.category-row-actions .row-action-form {
    align-items: center;
    display: inline-flex;
    margin: 0;
}

.category-table-action {
    align-items: center;
    background: #fff;
    border: 1px solid #cbd2da;
    border-radius: .5rem;
    color: var(--brand-ink-soft);
    display: inline-flex;
    flex: 0 0 36px;
    height: 36px;
    justify-content: center;
    margin: 0;
    padding: 0;
    width: 36px;
}

.category-table button.category-table-action {
    cursor: pointer;
}

.category-table-action .btn-icon {
    display: block;
}

.category-table .category-table-action:hover {
    background: #eef1f5;
    border-color: var(--brand-color-primary);
    color: var(--brand-color-primary);
}

.category-table .category-table-action-danger {
    color: var(--brand-danger);
}

.category-table .category-table-action-danger:hover {
    background: #fff0ee;
    border-color: var(--brand-danger);
    color: var(--brand-danger);
}

.category-table .category-table-action:disabled {
    background: #f1f3f5;
    border-color: #e1e5ea;
    color: #b9c0c9;
    cursor: default;
}

.category-table .category-add-child-action {
    background: #edf0f4;
    color: var(--brand-color-primary);
}

.category-table tr.is-hidden > td:not(.row-actions):not(.category-visibility-cell) {
    filter: grayscale(1);
    opacity: .48;
}

.visibility-note {
    color: var(--brand-muted);
    display: inline-block;
    font-size: .6rem;
    font-style: italic;
    line-height: 1.35;
    max-width: 145px;
}

.category-modal {
    width: min(700px,calc(100vw - 2rem));
}

.form-grid.two.category-fields-grid {
    grid-template-columns: var(--control-size) minmax(0,1fr);
}

.category-fields-grid [data-field="color"] {
    grid-column: 1;
}

.category-fields-grid [data-field="name"] {
    grid-column: 2;
}

.category-fields-grid [data-field="parent"], .category-fields-grid [data-field="income_source"] {
    grid-column: 1 / -1;
}

.category-subcategory-form .category-fields-grid [data-field="name"] {
    grid-column: 1 / -1;
}

.category-modal [data-field="color"] input {
    aspect-ratio: 1 / 1;
    height: var(--control-size);
    padding: 3px;
    width: var(--control-size);
}

.category-income-source-toggle {
    width: 100%;
}

/* ========================================================================== */
/* 7. Profile                                                                */
/* ========================================================================== */

.profile-nav-button {
    overflow: hidden;
}

.profile-nav-button.active {
    background: rgba(255,255,255,.18);
    border-color: transparent;
}

.profile-nav-button img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.profile-page {
    margin: 0 auto;
    width: 100%;
}

.profile-page-head {
    align-items: center;
    margin-bottom: 0;
}

.profile-page-head h1 {
    margin: 0;
}

.profile-page-divider {
    border: 0;
    border-top: 1px solid var(--brand-line);
    margin: 0 0 1.25rem;
}

.profile-avatar-control {
    flex: 0 0 auto;
    margin-left: auto;
}

.profile-avatar-control form {
    margin: 0;
}

.profile-avatar-frame {
    align-items: center;
    background: #e9edf2;
    border: 1px solid rgba(var(--brand-color-primary-rgb),.2);
    border-radius: 1rem;
    box-shadow: var(--brand-shadow);
    color: var(--brand-color-primary);
    display: flex;
    height: 78px;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    position: relative;
    width: 78px;
}

.profile-avatar-frame img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.profile-avatar-empty {
    background: var(--brand-color-primary);
    border-color: var(--brand-color-primary);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease,border-color .15s ease,color .15s ease;
}

.profile-avatar-empty:hover, .profile-avatar-empty:focus-visible {
    background: var(--brand-color-primary-dark);
    border-color: var(--brand-color-primary-dark);
    color: #fff;
    outline: none;
}

.profile-avatar-add-icon {
    font-size: 22px;
    line-height: 1;
    width: 22px;
}

.profile-avatar-delete-form {
    position: absolute;
    right: 5px;
    top: 5px;
}

.profile-avatar-delete-button {
    align-items: center;
    background: var(--brand-color-primary);
    border: 0;
    border-radius: .45rem;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 30px;
}

.profile-avatar-delete-button:hover, .profile-avatar-delete-button:focus-visible {
    background: var(--brand-color-primary-dark);
    outline: 2px solid #fff;
    outline-offset: -3px;
}

.profile-avatar-delete-button .btn-icon {
    font-size: 13px;
    width: 13px;
}

.profile-alert {
    margin: -0.6rem 0 1rem;
}

.profile-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 1fr;
}

.profile-card {
    min-width: 0;
    padding: clamp(1.1rem,2.5vw,1.5rem);
}

.profile-card-title {
    color: var(--brand-ink);
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -.025em;
    line-height: 1.2;
    margin: 0 0 1.1rem;
}

.profile-account-fields {
    border-top: 1px solid var(--brand-line);
    display: grid;
}

.profile-account-row {
    align-items: center;
    border-bottom: 1px solid var(--brand-line);
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(130px,18%) minmax(0,1fr);
    padding: .75rem 0;
}

.profile-account-row > label {
    color: var(--brand-muted);
    font-size: .85rem;
    font-weight: 750;
    margin: 0;
}

.profile-account-control {
    display: grid;
    gap: .35rem;
    min-width: 0;
}

.profile-account-control input, .profile-account-control select {
    width: 100%;
}

.profile-account-control .error {
    color: var(--brand-danger);
    font-size: .7rem;
}

.profile-account-row.has-error input, .profile-account-row.has-error select {
    border-color: var(--brand-danger);
}

.profile-card .form-actions {
    border-top: 1px solid var(--brand-line);
    margin-top: .15rem;
    padding-top: 1rem;
}

.profile-personal-card .form-actions {
    border-top: 0;
    margin-top: 1rem;
    padding-top: 0;
}

.profile-card input:disabled {
    background: #e8ebef;
    color: var(--brand-muted);
    cursor: not-allowed;
}

.profile-password-card {
    grid-column: 1;
}

.password-layout {
    align-items: start;
    display: grid;
    gap: clamp(1.4rem,4vw,3rem);
    grid-template-columns: minmax(0,1fr) minmax(300px,.75fr);
}

.password-fields {
    display: grid;
    gap: 1rem;
}

.password-guidance {
    background: #f6f7f9;
    border: 1px solid #d9dee5;
    border-radius: .8rem;
    padding: 1rem 1.1rem;
}

.password-guidance > div:first-child {
    align-items: center;
    display: flex;
    gap: .65rem;
}

.password-guidance > div:first-child > span {
    align-items: center;
    background: #e9edf2;
    border-radius: .55rem;
    color: var(--brand-color-primary);
    display: flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.password-guidance h3 {
    font-size: .92rem;
    margin: 0;
}

.password-guidance ul {
    color: var(--brand-muted);
    display: grid;
    font-size: .74rem;
    gap: .5rem;
    line-height: 1.45;
    margin: .9rem 0 0;
    padding-left: 1.15rem;
}

.password-guidance .form-actions {
    margin-top: 1rem;
}

.profile-import-card {
    grid-column: 1;
}

.csv-import-layout {
    align-items: start;
    display: grid;
    gap: clamp(1.4rem,4vw,3rem);
    grid-template-columns: minmax(0,1fr) minmax(300px,.75fr);
}

.csv-import-form {
    min-width: 0;
}

.csv-import-form input[type="file"] {
    cursor: pointer;
    padding: .45rem;
}

.csv-import-form input[type="file"]::file-selector-button {
    background: #eef1f5;
    border: 0;
    border-radius: .4rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 750;
    margin-right: .7rem;
    padding: .5rem .65rem;
}

.csv-import-actions {
    border-top: 1px solid var(--brand-line);
    padding-top: 1rem;
}

.csv-import-guidance {
    background: #f6f7f9;
    border: 1px solid #d9dee5;
    border-radius: .8rem;
    padding: 1rem 1.1rem;
}

.csv-import-guidance h3, .csv-import-history h3 {
    font-size: .92rem;
    margin: 0;
}

.csv-import-guidance ul {
    color: var(--brand-muted);
    display: grid;
    font-size: .74rem;
    gap: .5rem;
    line-height: 1.45;
    margin: .9rem 0 0;
    padding-left: 1.15rem;
}

.csv-import-history {
    border-top: 1px solid var(--brand-line);
    margin-top: 1.2rem;
    padding-top: 1rem;
}

.csv-import-history > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: .92rem;
    font-weight: 800;
    justify-content: space-between;
    list-style: none;
    min-height: 36px;
    outline: 0;
}

.csv-import-history > summary::-webkit-details-marker {
    display: none;
}

.csv-import-history > summary .btn-icon {
    color: var(--brand-ink-soft);
    font-size: 15px;
    transition: transform .18s ease;
    width: 15px;
}

.csv-import-history[open] > summary .btn-icon {
    transform: rotate(180deg);
}

.csv-import-history > summary:hover, .csv-import-history > summary:focus-visible {
    color: var(--brand-color-primary);
}

.csv-import-history > div {
    display: grid;
    margin-top: .75rem;
}

.csv-import-history-row {
    align-items: center;
    border-bottom: 1px solid #e1e5ea;
    display: grid;
    font-size: .76rem;
    gap: .4rem 1rem;
    grid-template-columns: 70px minmax(0,1fr) auto;
    min-height: 42px;
    padding: .4rem .2rem;
}

.csv-import-history-row:last-child {
    border-bottom: 0;
}

.csv-import-history-row small {
    white-space: nowrap;
}

/* ========================================================================== */
/* 8. Reports                                                                */
/* ========================================================================== */

.report-page-head {
    align-items: center;
}

.report-year-filter {
    align-items: center;
    display: flex;
    gap: .65rem;
}

.report-year-filter label {
    color: var(--brand-muted);
    font-size: .72rem;
    font-weight: 750;
    text-transform: uppercase;
}

.report-year-filter select {
    min-width: 112px;
}

.report-page {
    display: grid;
    gap: 1.25rem;
}

.surface-panel.report-section {
    min-width: 0;
    overflow: hidden;
    padding: 0;
}

.report-section-head {
    align-items: center;
    border-bottom: 1px solid var(--brand-line);
    display: flex;
    min-height: 58px;
    padding: .9rem 1.1rem;
}

.report-section-head h2 {
    font-size: 1.1rem;
    margin: 0;
}

.report-table-wrap {
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    scrollbar-color: rgba(var(--brand-color-primary-rgb),.48) transparent;
    scrollbar-width: thin;
}

.report-table-wrap::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.report-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.report-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-color-primary-rgb),.48);
    border-radius: 999px;
}

.report-table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--brand-color-primary-rgb),.72);
}

.report-matrix {
    border-collapse: separate;
    border-spacing: 0;
    font-size: .7rem;
    min-width: max-content;
    width: 100%;
}

.report-matrix th, .report-matrix td {
    background: #fff;
    border-bottom: 1px solid #dde2e8;
    padding: .7rem .75rem;
    text-align: right;
    white-space: nowrap;
}

.report-matrix thead th {
    background: #e9edf2;
    color: var(--brand-muted);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.report-matrix th:first-child {
    left: 0;
    min-width: 210px;
    position: sticky;
    text-align: left;
    z-index: 2;
}

.report-matrix thead th:first-child {
    z-index: 4;
}

.report-matrix td {
    min-width: 104px;
}

.report-matrix tr:last-child > * {
    border-bottom: 0;
}

.report-filter-link {
    border-radius: .3rem;
    color: inherit;
    display: block;
    margin: -.7rem -.75rem;
    padding: .7rem .75rem;
    text-align: inherit;
}

.report-filter-link:hover, .report-filter-link:focus-visible {
    background: rgba(var(--brand-color-primary-rgb),.07);
    color: inherit;
}

.report-filter-link:focus-visible {
    outline: 2px solid rgba(var(--brand-color-primary-rgb),.22);
    outline-offset: -2px;
}

.report-row-filter-link {
    text-align: left;
}

.report-total-cell {
    border-left: 2px solid #cbd2da;
    font-weight: 800;
}

.report-summary-row > * {
    font-weight: 750;
}

.report-summary-row.net > * {
    background: #667180;
    color: #fff;
}

.report-summary-row.income > * {
    background: #fbfcfd;
}

.report-summary-row.expense > * {
    background: #fbfcfd;
    border-bottom: 3px solid #cbd2da;
}

.report-category-row.category > * {
    background: #f3f5f7;
    border-top: 2px solid #cbd2da;
    font-weight: 800;
}

.report-category-row.category th {
    box-shadow: inset 4px 0 var(--report-color);
}

.report-category-row.subcategory th span {
    display: inline-block;
    padding-left: 1.75rem;
    position: relative;
}

.report-category-row.subcategory th span::before {
    border-bottom: 1px solid #bfc7d1;
    border-left: 1px solid #bfc7d1;
    border-radius: 0 0 0 .3rem;
    content: "";
    height: 18px;
    left: .35rem;
    position: absolute;
    top: -.65rem;
    width: .75rem;
}

.report-positive {
    color: #526a43;
}

.report-negative {
    color: var(--brand-danger);
}

.report-zero {
    color: #8c949e;
}

.report-summary-row.net .report-positive, .report-summary-row.net .report-negative, .report-summary-row.net .report-zero {
    color: #fff;
}

.account-trend-chart {
    min-height: 320px;
    padding: 1rem 1rem 0;
    position: relative;
}

.account-trend-chart canvas {
    cursor: crosshair;
    display: block;
    max-width: 100%;
    touch-action: pan-y;
}

.chart-point-tooltip {
    background: #fff;
    border: 1px solid #d5dae1;
    border-left: 4px solid var(--tooltip-color, var(--brand-color-primary));
    border-radius: .5rem;
    box-shadow: 0 10px 28px rgba(24,29,35,.16);
    color: var(--brand-ink);
    display: grid;
    font-size: .7rem;
    gap: .12rem;
    line-height: 1.25;
    max-width: 220px;
    padding: .5rem .65rem;
    pointer-events: none;
    position: absolute;
    white-space: nowrap;
    z-index: 5;
}

.chart-point-tooltip[hidden] {
    display: none;
}

.chart-point-tooltip strong {
    font-size: .72rem;
}

.chart-point-tooltip span {
    color: var(--brand-ink-soft);
    font-variant-numeric: tabular-nums;
}

.account-trend-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .6rem;
    padding: .75rem 1.1rem 1rem;
}

.account-trend-legend label {
    align-items: center;
    background: #f5f6f8;
    border: 1px solid #dde2e8;
    border-radius: .45rem;
    color: var(--brand-ink-soft);
    cursor: pointer;
    display: inline-flex;
    font-size: .64rem;
    font-weight: 700;
    gap: .4rem;
    min-height: 32px;
    padding: .3rem .55rem;
}

.account-trend-legend label:hover {
    border-color: #bfc7d1;
}

.account-trend-legend input {
    accent-color: var(--brand-color-primary);
    height: 14px;
    margin: 0;
    width: 14px;
}

.account-trend-legend i {
    background: var(--series-color);
    border-radius: 2px;
    display: block;
    height: 10px;
    width: 10px;
}

.account-history-table-wrap {
    border-top: 1px solid var(--brand-line);
}

.account-history-table th:first-child {
    min-width: 210px;
}

.report-account-total > * {
    background: #667180;
    color: #fff;
    font-weight: 800;
}

.report-account-row th {
    box-shadow: inset 4px 0 var(--report-color);
}

/* ========================================================================== */
/* 9. Responsive rules                                                       */
/* ========================================================================== */

@media (min-width: 1200px) {
    .dashboard-charts-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .report-table-wrap {
        overflow: visible;
    }

    .report-matrix {
        font-size: clamp(.57rem,.65vw,.7rem);
        min-width: 0;
        table-layout: fixed;
    }

    .report-matrix th,
    .report-matrix td {
        min-width: 0;
        padding: .65rem .32rem;
    }

    .report-matrix thead th {
        font-size: clamp(.54rem,.57vw,.62rem);
    }

    .report-matrix th:first-child,
    .account-history-table th:first-child {
        min-width: 0;
        position: static;
        width: 180px;
    }

    .report-filter-link {
        margin: -.65rem -.32rem;
        padding: .65rem .32rem;
    }

    .dashboard-category-history-table-wrap {
        overflow: auto;
    }

    .dashboard-category-history-table {
        min-width: max-content;
        table-layout: auto;
    }

    .dashboard-category-history-table th,
    .dashboard-category-history-table td {
        padding: .65rem .75rem;
    }

    .dashboard-category-history-table th:first-child {
        min-width: 92px;
        position: sticky;
        width: auto;
    }

    .dashboard-category-history-table th:not(:first-child),
    .dashboard-category-history-table td {
        min-width: 112px;
    }

    .dashboard-category-history-table .report-filter-link {
        margin: -.65rem -.75rem;
        padding: .65rem .75rem;
    }
}

@media (min-width: 1101px) {
    .transactions-table-panel .table-wrap {
        max-height: none;
        overflow-x: auto;
    }

    .transactions-table-panel.has-open-filter-menu:not(.has-clipped-filter-menu),
    .transactions-table-panel.has-open-filter-menu:not(.has-clipped-filter-menu) .table-wrap {
        overflow: visible;
    }

    .transactions-table-panel.has-clipped-filter-menu .table-wrap {
        min-height: 350px;
    }
}

@media (max-width: 1100px) {
    .desktop-nav {
        display: none;
    }

    .mobile-nav {
        display: block;
    }

    .kpi-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .income-projection-metrics {
        grid-template-columns: repeat(3,minmax(0,1fr));
    }

    .income-projection-metrics > div:nth-child(4) {
        border-left: 0;
    }

    .income-projection-metrics > div:nth-child(n/**/+4) {
        border-top: 1px solid var(--brand-line);
        padding-top: .8rem;
    }

    .income-projection-layout {
        grid-template-columns: 1fr;
    }

    .income-source-detail-list {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-password-card {
        grid-column: 1;
    }

    .movement-component-main-fields {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .movement-component-row > .movement-allocation {
        grid-column: 1 / -1;
    }
}

@media (max-width: 760px) {
    body {
        -webkit-text-size-adjust: 100%;
    }

    .navbar-inner {
        gap: .6rem;
    }

    .app-brand {
        min-width: 0;
    }

    .app-brand span {
        min-width: 0;
    }

    .app-brand strong {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .navbar-actions {
        gap: .2rem;
    }

    .nav-menu-right {
        max-height: calc(100dvh - var(--navbar-height) - 1rem);
        overflow-y: auto;
        position: fixed;
        right: .75rem;
        top: calc(var(--navbar-height) - .15rem);
        width: min(290px,calc(100vw - 1.5rem));
    }

    .nav-menu a, .nav-menu button {
        min-height: 44px;
        padding: .7rem .8rem;
    }

    .income-projection-metrics {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .income-projection-metrics > div:nth-child(odd) {
        border-left: 0;
    }

    .income-projection-metrics > div:nth-child(n/**/+3) {
        border-top: 1px solid var(--brand-line);
        padding-top: .8rem;
    }

    h1 {
        font-size: clamp(2rem,10vw,2.65rem);
    }

    .page-head > div:first-child {
        flex: 1 1 0;
        min-width: 0;
    }

    .dashboard-page-head > div:first-child {
        flex-basis: 100%;
    }

    .dashboard-history-head {
        align-items: stretch !important;
        flex-direction: column;
    }

    .dashboard-chart-range {
        display: grid;
        grid-template-columns: repeat(2,minmax(0,1fr)) auto auto;
        width: 100%;
    }

    .dashboard-chart-range label {
        min-width: 0;
    }

    .dashboard-chart-caption {
        text-align: left;
    }

    .dashboard-period-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-period-picker {
        flex: 1 1 auto;
        min-width: 0;
    }

    .dashboard-period-picker form {
        flex: 1 1 auto;
        min-width: 0;
    }

    .dashboard-period-picker .form-select, .dashboard-period-picker .form-control {
        width: 100%;
    }

    .period-view-switch a {
        min-height: 38px;
        padding-inline: .55rem;
    }

    .dashboard-total-chart {
        min-height: 250px;
        padding-inline: 0;
    }

    .dashboard-annual-net-chart {
        min-height: 250px;
        padding-inline: 0;
    }

    .dashboard-annual-net-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-year-selector summary {
        width: 100%;
    }

    .dashboard-year-selector-menu {
        left: 0;
        min-width: 0;
        right: 0;
        width: 100%;
    }

    .dashboard-summary-grid {
        grid-template-columns: 1fr;
    }

    .category-breakdown-grid {
        grid-template-columns: 1fr;
    }

    .category-breakdown + .category-breakdown {
        border-left: 0;
        border-top: 1px solid var(--brand-line);
        padding-left: 0;
        padding-top: 1.1rem;
    }

    .report-page-head .report-year-filter {
        flex: 0 0 auto;
    }

    .account-trend-chart {
        min-height: 250px;
        padding-inline: .35rem;
    }

    .dashboard-category-history-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-category-history-filter {
        align-items: stretch;
        flex-direction: column;
        gap: .35rem;
        width: 100%;
    }

    .dashboard-category-history-filter select {
        min-width: 0;
        width: 100%;
    }

    .dashboard-category-stack-chart {
        min-height: 280px;
        padding-inline: .35rem;
    }

    .dashboard-category-stack-legend {
        padding-inline: .75rem;
    }

    .report-matrix th:first-child {
        min-width: 170px;
    }

    .page-head > .btn {
        align-self: center;
    }

    .page-actions {
        flex: 1 0 100%;
        justify-content: stretch;
    }

    .surface-panel {
        border-radius: .75rem;
        padding: 1rem;
    }

    input, select, textarea, .table-filter-control {
        font-size: 16px !important;
    }

    .form-inline-help {
        align-items: flex-start;
        flex-direction: column;
        gap: .4rem;
    }

    .form-inline-help a {
        white-space: normal;
    }

    .kpi-grid {
        gap: .75rem;
    }

    .kpi-card {
        min-height: 125px;
    }

    .panel-head {
        align-items: center;
    }

    .form-grid.two {
        grid-template-columns: 1fr;
    }

    .form-grid.two.category-fields-grid {
        grid-template-columns: 1fr;
    }

    .category-fields-grid [data-field="color"], .category-fields-grid [data-field="name"] {
        grid-column: 1;
    }

    .account-details-row {
        grid-template-columns: 1fr;
    }

    .transaction-core-grid, .movement-common-grid, .transfer-notes-grid {
        grid-template-columns: 1fr;
    }

    .movement-common-grid {
        width: 100%;
    }

    .movement-component-main-fields {
        grid-template-columns: minmax(0,1fr);
    }

    .movement-component-row > .movement-allocation {
        grid-column: 1 / -1;
    }

    .movement-allocation-panel {
        grid-template-columns: 1fr;
    }

    .movement-allocation-panel > small {
        grid-column: 1;
    }

    .password-layout {
        grid-template-columns: 1fr;
    }

    .csv-import-layout {
        grid-template-columns: 1fr;
    }

    .csv-import-history-row {
        align-items: start;
        grid-template-columns: 58px minmax(0,1fr);
    }

    .csv-import-history-row small {
        grid-column: 2;
    }

    .profile-page-head {
        align-items: center;
    }

    .transaction-modal, .account-modal, .category-modal {
        height: 100dvh;
        inset: 0;
        margin: 0;
        max-height: 100dvh;
        width: 100vw;
    }

    .transaction-modal-content {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        gap: .85rem;
        min-height: 100dvh;
        max-height: 100dvh;
        padding: 1rem max(1rem,env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(1rem,env(safe-area-inset-left));
    }

    .transaction-modal .modal-head {
        background: var(--brand-surface);
        border-bottom: 1px solid var(--brand-line);
        margin: -1rem -1rem 0;
        padding: 1rem;
        position: sticky;
        top: -1rem;
        z-index: 6;
    }

    .transaction-modal form > .form-actions {
        background: var(--brand-surface);
        border-top: 1px solid var(--brand-line);
        bottom: calc(-1rem - env(safe-area-inset-bottom));
        margin: .2rem -1rem -1rem;
        padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
        position: sticky;
        z-index: 5;
    }

    .movement-components, .movement-transfer-fields {
        padding: .65rem;
    }

    .movement-components-head {
        align-items: center;
    }

    .movement-components-actions {
        flex-direction: row;
    }

    .account-active-toggle {
        width: 100%;
    }

    .account-sharing-field > div {
        max-height: min(240px,32dvh);
    }

    .transactions-table-panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .transactions-table-panel .table-wrap {
        overflow: visible;
    }

    .transactions-table, .transactions-table.wide {
        border-collapse: separate;
        display: block;
        min-width: 0;
        table-layout: auto;
        width: 100%;
    }

    .transactions-table colgroup {
        display: none;
    }

    .transactions-table thead, .transactions-table tbody {
        display: block;
    }

    .transactions-table .column-filters {
        background: var(--brand-surface);
        border: 1px solid var(--brand-line);
        border-radius: .75rem;
        box-shadow: var(--brand-shadow);
        display: grid;
        gap: .55rem;
        grid-template-columns: repeat(2,minmax(0,1fr));
        margin-bottom: .75rem;
        padding: .65rem;
    }

    .transactions-table .column-filters th, .transactions-table .column-filters th:first-child, .transactions-table .column-filters th:last-child {
        background: transparent;
        border: 0;
        display: block;
        padding: 0;
    }

    .transactions-table .column-filters th:nth-child(2), .transactions-table .column-filters th:nth-child(7), .transactions-table .column-filters th:nth-child(8) {
        grid-column: 1 / -1;
    }

    .table-filter-control, .year-multiselect summary, .filter-multiselect summary {
        min-height: 44px;
    }

    .year-multiselect-options, .filter-multiselect-options, .subcategory-multiselect-options {
        left: 0;
        max-width: calc(100vw - 3rem);
        min-width: 100%;
        width: max-content;
    }

    .year-multiselect-options label, .filter-multiselect-options label {
        min-height: 42px;
    }

    .column-filter-actions .btn {
        flex: 1 1 0;
        max-width: none;
        width: auto;
    }

    .transactions-table tbody[data-transaction-table-body] {
        display: grid;
        gap: .65rem;
    }

    .transactions-table tbody[data-transaction-table-body] > tr:not([data-transaction-row]) {
        display: block;
    }

    .transactions-table tbody[data-transaction-table-body] > tr:not([data-transaction-row]) > td {
        display: block;
    }

    .transactions-table tr[data-transaction-row] {
        background: var(--brand-surface);
        border: 1px solid var(--brand-line);
        border-radius: .75rem;
        box-shadow: 0 5px 16px rgba(27,32,39,.06);
        display: grid;
        gap: .15rem .65rem;
        grid-template-columns: minmax(0,1fr) auto;
        overflow: hidden;
        padding: .75rem;
    }

    .transactions-table tr[data-transaction-row] > td {
        background: transparent !important;
        border: 0;
        box-shadow: none !important;
        display: grid;
        font-size: .78rem;
        height: auto;
        min-width: 0;
        padding: .25rem 0;
        text-align: left;
    }

    .transactions-table tr[data-transaction-row] > td[data-mobile-label]::before, .account-kind-cell::before, .account-access-cell::before, .account-balance::before {
        color: var(--brand-muted);
        content: attr(data-mobile-label);
        font-size: .55rem;
        font-weight: 850;
        letter-spacing: .055em;
        line-height: 1.15;
        margin-bottom: .12rem;
        text-transform: uppercase;
    }

    .transactions-table .transaction-year {
        display: none;
    }

    .transactions-table .transaction-date-cell time {
        font-size: 0;
    }

    .transactions-table .transaction-date-cell time::after {
        content: attr(data-mobile-date);
        font-size: .78rem;
    }

    .transactions-table .transaction-date-cell {
        grid-column: 1;
        grid-row: 1;
    }

    .transactions-table .transaction-drag-handle {
        height: 40px;
        width: 40px;
    }

    .transactions-table .transaction-drag-spacer {
        flex-basis: 40px;
        width: 40px;
    }

    .transactions-table .transaction-date-cell .movement-group-label {
        margin-left: 44px;
    }

    .transactions-table .transaction-amount-cell {
        align-content: start;
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }

    .transactions-table .transaction-amount-cell::before {
        text-align: right;
    }

    .transactions-table .transaction-account-cell {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .transactions-table .transaction-category-cell {
        grid-column: 1;
        grid-row: 3;
    }

    .transactions-table .transaction-subcategory-cell {
        grid-column: 2;
        grid-row: 3;
        justify-items: end;
    }

    .transactions-table .transaction-subcategory-cell::before {
        text-align: right;
    }

    .transactions-table .transaction-note {
        border-top: 1px solid #edf0f3 !important;
        grid-column: 1 / -1;
        grid-row: 4;
        margin-top: .2rem;
        max-width: none;
        min-width: 0;
        padding-top: .55rem !important;
    }

    .transactions-table .row-actions {
        align-items: center;
        border-top: 1px solid #edf0f3 !important;
        display: flex !important;
        grid-column: 1 / -1;
        grid-row: 5;
        justify-content: flex-end;
        margin-top: .15rem;
        padding-top: .55rem !important;
    }

    .transactions-table .row-actions .table-action {
        height: 44px;
        min-height: 44px;
        min-width: 44px;
        width: 44px;
    }

    .accounts-table-panel, .category-table-panel {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .accounts-table-panel .table-wrap, .category-table-panel .table-wrap {
        overflow: visible;
    }

    .accounts-table {
        display: block;
        min-width: 0;
    }

    .accounts-table tbody {
        display: grid;
        gap: .7rem;
    }

    .accounts-table tbody > tr:not([data-account-row]) {
        display: block;
    }

    .accounts-table tbody > tr:not([data-account-row]) > td {
        display: block;
    }

    .accounts-table tr[data-account-row] {
        background: var(--brand-surface);
        border: 1px solid var(--brand-line);
        border-radius: .75rem;
        box-shadow: 0 5px 16px rgba(27,32,39,.06);
        display: grid;
        gap: .2rem .6rem;
        grid-template-columns: 84px minmax(0,1fr) auto;
        padding: .7rem;
    }

    .accounts-table tr[data-account-row] > td {
        border: 0;
        display: grid;
        height: auto;
        padding: .2rem 0;
        text-align: left;
    }

    .accounts-table .account-color-cell {
        grid-column: 1;
        grid-row: 1 / 3;
        padding: 0 !important;
        width: auto;
    }

    .accounts-table .account-name-cell {
        align-content: center;
        grid-column: 2;
        grid-row: 1;
    }

    .accounts-table .account-balance {
        align-content: center;
        grid-column: 3;
        grid-row: 1;
        text-align: right;
    }

    .accounts-table .account-balance::before {
        text-align: right;
    }

    .accounts-table .account-status-cell {
        grid-column: 2;
        grid-row: 2;
    }

    .accounts-table .row-actions {
        align-items: center;
        display: flex;
        grid-column: 3;
        grid-row: 2;
        justify-content: flex-end;
    }

    .accounts-table .account-kind-cell {
        border-top: 1px solid #edf0f3 !important;
        grid-column: 1 / -1;
        grid-row: 3;
        margin-top: .25rem;
        padding-top: .55rem !important;
    }

    .accounts-table .account-access-cell {
        grid-column: 1 / -1;
        grid-row: 4;
    }

    .accounts-table .row-actions .table-action {
        height: 44px;
        min-height: 44px;
        min-width: 44px;
        width: 44px;
    }

    .account-drag-handle {
        height: 44px;
        width: 40px;
    }

    .account-color-input, .account-color-swatch {
        height: 44px;
        width: 44px;
    }

    .category-table {
        border-collapse: separate;
        display: block;
        min-width: 0;
        table-layout: auto;
    }

    .category-table colgroup {
        display: none;
    }

    .category-table-group {
        background: var(--brand-surface);
        border: 1px solid var(--brand-line);
        border-radius: .75rem;
        box-shadow: 0 5px 16px rgba(27,32,39,.06);
        display: block;
        margin-bottom: .7rem;
        overflow: hidden;
    }

    .category-table > tbody:not(.category-table-group) {
        display: block;
    }

    .category-table > tbody:not(.category-table-group) tr, .category-table > tbody:not(.category-table-group) td {
        display: block;
    }

    .category-table .category-root-row, .category-table .category-child-row {
        display: grid;
        gap: .2rem .55rem;
        grid-template-columns: 52px minmax(0,1fr) auto;
        padding: .55rem .65rem;
    }

    .category-table .category-child-row {
        border-top: 1px solid var(--brand-line);
    }

    .category-table .category-root-row > td, .category-table .category-child-row > td {
        border: 0;
        box-shadow: none;
        display: grid;
        height: auto;
        padding: .15rem 0;
    }

    .category-table-group + .category-table-group .category-root-row > td {
        border-top: 0;
    }

    .category-table .category-color-cell {
        align-content: center;
        grid-column: 1;
        grid-row: 1 / 3;
        padding: 0 !important;
        width: auto;
    }

    .category-table .category-identity-cell {
        align-content: center;
        grid-column: 2;
        grid-row: 1;
        padding-left: 0 !important;
    }

    .category-table .category-visibility-cell {
        align-content: center;
        grid-column: 2;
        grid-row: 2;
        text-align: left;
    }

    .category-table .row-actions {
        align-items: center;
        align-self: center;
        display: flex;
        grid-column: 3;
        grid-row: 1 / 3;
        justify-content: flex-end;
        min-width: 0;
        padding: 0;
    }

    .category-table .subcategory-identity::before {
        display: none;
    }

    .category-drag-handle, .category-table-action {
        height: 44px;
        width: 44px;
    }

    .category-color-input, .category-color-swatch {
        height: 44px;
        width: 44px;
    }

    .visibility-note {
        max-width: none;
    }

    input[type="file"] {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.2rem;
    }

    .app-brand small {
        display: none;
    }

    .navbar-actions {
        gap: .25rem;
    }

    .navbar-actions > .icon-button, .navbar-actions > form {
        display: none;
    }

    .notification-panel {
        right: -48px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-card {
        min-height: 125px;
    }

    .income-projection-metrics {
        grid-template-columns: 1fr;
    }

    .income-projection-metrics > div {
        border-left: 0 !important;
    }

    .income-projection-metrics > div + div {
        border-top: 1px solid var(--brand-line);
        padding-top: .8rem;
    }

    .income-projection-empty {
        align-items: stretch;
        flex-direction: column;
    }

    .income-source-detail-list {
        grid-template-columns: 1fr;
    }

    .dashboard-chart-range {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .dashboard-chart-range .btn {
        max-width: none;
        width: 100%;
    }

    .transactions-table .column-filters {
        grid-template-columns: 1fr;
    }

    .transactions-table .column-filters th {
        grid-column: 1 !important;
    }

    .transactions-table .transaction-category-cell, .transactions-table .transaction-subcategory-cell {
        grid-column: 1 / -1;
        justify-items: start;
    }

    .transactions-table .transaction-category-cell {
        grid-row: 3;
    }

    .transactions-table .transaction-subcategory-cell {
        grid-row: 4;
    }

    .transactions-table .transaction-subcategory-cell::before {
        text-align: left;
    }

    .transactions-table .transaction-note {
        grid-row: 5;
    }

    .transactions-table .row-actions {
        grid-row: 6;
    }

    .accounts-table tr[data-account-row] {
        grid-template-columns: 84px minmax(0,1fr);
    }

    .accounts-table .account-balance {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
    }

    .accounts-table .account-balance::before {
        text-align: left;
    }

    .accounts-table .account-status-cell {
        grid-column: 1;
        grid-row: 3;
    }

    .accounts-table .row-actions {
        grid-column: 2;
        grid-row: 3;
    }

    .accounts-table .account-kind-cell {
        grid-row: 4;
    }

    .accounts-table .account-access-cell {
        grid-row: 5;
    }

    .profile-page-head {
        align-items: center;
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .profile-page-head > div:first-child {
        flex: 1 1 auto;
    }

    .profile-avatar-frame {
        border-radius: .75rem;
        height: 68px;
        width: 68px;
    }

    .profile-account-row {
        align-items: start;
        gap: .4rem;
        grid-template-columns: 1fr;
    }

    .transaction-delete-summary {
        grid-template-columns: 1fr;
    }

    .transaction-delete-summary span, .transaction-delete-summary p {
        grid-column: 1;
    }
}

/* ========================================================================== */
/* 10. CSV import workflow                                                   */
/* ========================================================================== */

.import-page {
    display: grid;
    gap: 1.25rem;
}

.import-setup-form {
    display: grid;
    gap: 1.25rem;
}

.import-steps {
    background: var(--brand-surface);
    border: 1px solid var(--brand-line);
    border-radius: var(--brand-radius);
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    overflow: hidden;
}

.import-steps > a, .import-steps > span {
    align-items: center;
    color: var(--brand-muted);
    display: flex;
    font-weight: 700;
    gap: .7rem;
    min-height: 64px;
    padding: .75rem 1rem;
    text-decoration: none;
}

.import-steps > * + * {
    border-left: 1px solid var(--brand-line);
}

.import-steps > .is-active {
    background: rgba(var(--brand-color-primary-rgb),.08);
    color: var(--brand-color-primary);
}

.import-steps > * > span {
    align-items: center;
    background: var(--brand-bg);
    border: 1px solid var(--brand-line);
    border-radius: .55rem;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.import-section {
    padding: 1.25rem;
}

.import-section-head, .import-editor-heading, .import-group-head, .import-editor-footer {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.import-section-head {
    margin-bottom: 1rem;
}

.import-section-head h2, .import-editor-heading h2 {
    margin: .15rem 0 0;
}

.import-mapping-list, .import-category-groups {
    display: grid;
    gap: .8rem;
}

.import-mapping-list {
    border: 1px solid var(--brand-line);
    border-radius: .85rem;
    gap: 0;
    overflow: hidden;
}

.import-mapping-row {
    align-items: end;
    background: var(--brand-surface);
    display: grid;
    gap: .75rem 1rem;
    grid-template-columns: minmax(190px,.8fr) minmax(170px,.65fr) minmax(0,2.4fr);
    padding: .9rem 1rem;
}

.import-mapping-list .import-mapping-row + .import-mapping-row,
.import-category-group-items .import-mapping-row + .import-mapping-row {
    border-top: 1px solid var(--brand-line);
}

.import-source-value {
    align-content: center;
    align-self: stretch;
    display: grid;
    gap: .25rem;
    min-width: 0;
}

.import-source-value small {
    color: var(--brand-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.import-existing-fields, .import-merge-fields {
    align-content: end;
    grid-column: 3;
}

.import-create-fields {
    display: grid;
    gap: .7rem;
    grid-column: 3;
}

.import-mapping-row [hidden] {
    display: none !important;
}

.import-account-create-fields {
    grid-template-columns: 64px minmax(190px,1.4fr) minmax(155px,1fr) minmax(145px,.8fr) minmax(145px,.7fr);
}

.import-account-create-fields .field input.account-color-input,
.import-category-create-fields .field input.category-color-input {
    flex: 0 0 var(--control-size);
    height: var(--control-size);
    min-height: var(--control-size);
    padding: 3px;
    width: var(--control-size);
}

.import-category-mapping-row.is-root .import-category-create-fields {
    grid-template-columns: 64px minmax(220px,1fr);
}

.import-category-mapping-row.is-child .import-category-create-fields {
    grid-template-columns: minmax(220px,1fr);
}

.import-account-mapping-row {
    align-items: start;
}

.import-account-mapping-row .import-source-value {
    align-content: start;
}

.import-sharing-field {
    grid-column: 1 / -1;
}

.import-sharing-empty {
    background: var(--brand-bg);
    border: 1px solid var(--brand-line);
    border-radius: .7rem;
    padding: .65rem .75rem;
}

.import-category-group {
    border: 1px solid var(--brand-line);
    border-radius: .85rem;
    overflow: hidden;
}

.import-category-group-items {
    border-top: 1px solid var(--brand-line);
}

.import-category-mapping-row.is-root {
    background: rgba(var(--brand-color-primary-rgb),.055);
    position: relative;
}

.import-category-mapping-row.is-root::before {
    background: var(--brand-color-primary);
    bottom: 0;
    content: "";
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

.import-category-mapping-row.is-child .import-source-value {
    padding-left: 1.35rem;
    position: relative;
}

.import-category-mapping-row.is-child .import-source-value::before {
    border-bottom: 1px solid var(--brand-line);
    border-left: 1px solid var(--brand-line);
    border-radius: 0 0 0 .45rem;
    content: "";
    height: 1rem;
    left: .2rem;
    position: absolute;
    top: .35rem;
    width: .75rem;
}

.import-page-actions {
    align-items: center;
    display: flex;
    gap: .7rem;
    justify-content: flex-end;
}

.csv-import-drafts {
    border-top: 1px solid var(--brand-line);
    margin-top: 1.25rem;
    padding-top: 1rem;
}

.csv-import-drafts h3 {
    margin-top: 0;
}

.csv-import-drafts .row-actions {
    align-items: center;
    display: flex;
    gap: .45rem;
    justify-self: end;
}

.csv-import-drafts .row-actions form {
    display: flex;
    margin: 0;
}

.import-review-summary {
    align-items: end;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4,minmax(100px,1fr)) minmax(180px,1.4fr);
    padding: 1rem 1.25rem;
}

.import-review-summary > div {
    display: grid;
    gap: .2rem;
}

.import-review-summary span, .import-status-filter label {
    color: var(--brand-muted);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.import-review-summary strong {
    font-size: 1.5rem;
}

.import-status-filter {
    display: grid;
    gap: .3rem;
}

.import-group-list {
    display: grid;
    gap: .8rem;
}

.import-group-card {
    border-left: 4px solid var(--brand-line);
    overflow: hidden;
    scroll-margin-top: 6rem;
}

.import-group-card.is-approved {
    border-left-color: #47704c;
}

.import-group-card.is-skipped {
    border-left-color: var(--brand-danger);
    opacity: .72;
}

.import-group-head {
    background: var(--brand-bg);
    border-bottom: 1px solid var(--brand-line);
    padding: .85rem 1rem;
}

.import-group-head > div {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.import-decision-badge {
    background: var(--brand-surface);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
    padding: .3rem .55rem;
}

.is-approved .import-decision-badge {
    color: #47704c;
}

.is-skipped .import-decision-badge {
    color: var(--brand-danger);
}

.import-group-lines {
    display: grid;
}

.import-group-line {
    align-items: center;
    display: grid;
    gap: .8rem;
    grid-template-columns: 52px minmax(110px,.55fr) minmax(150px,.8fr) minmax(180px,1fr) minmax(160px,1.3fr) auto;
    padding: .75rem 1rem;
}

.import-group-line + .import-group-line {
    border-top: 1px solid var(--brand-line);
}

.import-group-line small {
    color: var(--brand-muted);
}

.amount-positive {
    color: #47704c;
}

.amount-negative {
    color: var(--brand-danger);
}

.import-group-actions {
    align-items: center;
    border-top: 1px solid var(--brand-line);
    display: flex;
    gap: .45rem;
    justify-content: space-between;
    padding: .65rem 1rem;
}

.import-group-actions form,
.import-group-actions-end {
    align-items: center;
    display: flex;
    margin: 0;
}

.import-group-actions-end {
    gap: .45rem;
    margin-left: auto;
}

.import-merge-form {
    margin: 0;
}

.import-merge-form.has-selection {
    bottom: max(1rem,env(safe-area-inset-bottom));
    position: fixed;
    right: max(1rem,env(safe-area-inset-right));
    z-index: 1040;
}

.import-merge-form.has-selection .btn {
    background: var(--brand-color-primary);
    border-color: var(--brand-color-primary);
    box-shadow: 0 12px 30px rgba(24,28,34,.22);
    color: #fff;
}

.import-merge-form .btn {
    position: relative;
}

.import-selection-count {
    align-items: center;
    background: #fff;
    border: 2px solid var(--brand-color-primary);
    border-radius: 999px;
    color: var(--brand-color-primary);
    display: flex;
    font-size: .62rem;
    font-weight: 900;
    height: 1.25rem;
    justify-content: center;
    min-width: 1.25rem;
    padding: 0 .2rem;
    position: absolute;
    right: -.45rem;
    top: -.45rem;
}

.import-selection-count[hidden] {
    display: none !important;
}

.import-group-selector,
.import-line-selector {
    cursor: pointer;
}

.import-group-selector.is-selected,
.import-line-selector.is-selected {
    background: var(--brand-color-primary);
    border-color: var(--brand-color-primary);
    color: #fff;
}

[data-import-split-form] .btn {
    position: relative;
}

.import-editor-form {
    display: grid;
    gap: 1.25rem;
    padding: 1.25rem;
}

.import-modal-editor-form {
    padding: 0;
}

.import-group-common-fields {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(240px,.45fr) minmax(300px,1fr);
}

.import-line-list {
    display: grid;
    gap: .75rem;
}

.import-line-form {
    align-items: end;
    background: var(--brand-bg);
    border: 1px solid var(--brand-line);
    border-radius: .8rem;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(120px,.55fr) minmax(180px,1fr) minmax(200px,1.2fr) minmax(180px,1fr) minmax(220px,1.2fr) 52px;
    padding: .9rem;
}

.import-line-form.is-deleted {
    opacity: .45;
}

.import-line-delete input {
    position: absolute;
    visibility: hidden;
}

.import-line-delete span {
    align-items: center;
    background: #fff0ee;
    border-radius: .7rem;
    color: var(--brand-danger);
    cursor: pointer;
    display: flex;
    height: 50px;
    justify-content: center;
    width: 50px;
}

.import-line-delete input:checked + span {
    background: var(--brand-danger);
    color: white;
}

.import-editor-footer {
    border-top: 1px solid var(--brand-line);
    padding-top: 1rem;
}

.import-editor-help {
    color: var(--brand-muted);
    font-size: .72rem;
    line-height: 1.45;
    max-width: 680px;
}

@media (max-width: 1100px) {
    .import-mapping-row {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .import-create-fields, .import-existing-fields, .import-merge-fields, .import-sharing-field {
        grid-column: 1 / -1;
    }

    .import-line-form {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .import-line-delete {
        justify-self: end;
    }
}

@media (max-width: 720px) {
    .import-steps {
        grid-template-columns: 1fr;
    }

    .import-steps > * + * {
        border-left: 0;
        border-top: 1px solid var(--brand-line);
    }

    .import-review-summary, .import-group-common-fields, .import-mapping-row, .import-create-fields, .import-line-form {
        grid-template-columns: 1fr;
    }

    .import-sharing-field, .import-create-fields, .import-existing-fields, .import-merge-fields {
        grid-column: 1;
        justify-self: stretch;
    }

    .import-group-line {
        align-items: start;
        grid-template-columns: 52px 1fr;
    }

    .import-group-line > :nth-child(n+3) {
        grid-column: 1 / -1;
    }

    .import-editor-footer {
        align-items: stretch;
        flex-direction: column;
    }
}
