.fm-container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.fm-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.fm-brand--large {
    gap: 14px;
}

.fm-wordmark {
    display: inline-flex;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.045em;
}

.fm-brand--large .fm-wordmark {
    font-size: 30px;
}

.fm-wordmark strong {
    color: var(--fm-text);
}

.fm-wordmark span {
    color: var(--fm-indigo);
}

.fm-eyebrow {
    display: inline-block;
    color: var(--fm-indigo);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.13em;
}

.fm-button {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: var(--fm-radius-md);
    padding: 0 18px;
    font-weight: 650;
    transition:
        transform var(--fm-transition),
        box-shadow var(--fm-transition),
        background var(--fm-transition),
        border-color var(--fm-transition);
}

.fm-button:hover {
    transform: translateY(-1px);
}

.fm-button--primary {
    background: linear-gradient(135deg, var(--fm-indigo), var(--fm-indigo-deep));
    color: #fff;
    box-shadow: 0 10px 24px rgba(79, 70, 229, 0.24);
}

.fm-button--primary:hover {
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.31);
}

.fm-button--secondary {
    border-color: var(--fm-border-color);
    background: var(--fm-surface);
    color: var(--fm-text);
    box-shadow: var(--fm-shadow-sm);
}

.fm-button--compact {
    min-height: 40px;
    padding-inline: 14px;
    font-size: 0.9rem;
}

.fm-button--full {
    width: 100%;
}

.fm-button svg,
.fm-icon-button svg,
.fm-nav-item svg {
    width: 19px;
    height: 19px;
}

.fm-icon-button {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
    color: var(--fm-text);
    box-shadow: var(--fm-shadow-sm);
    transition:
        background var(--fm-transition),
        border-color var(--fm-transition),
        transform var(--fm-transition);
}

.fm-icon-button:hover {
    transform: translateY(-1px);
    background: var(--fm-surface-soft);
}

.fm-card,
.fm-metric-card {
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-lg);
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
}

.fm-card {
    padding: 24px;
}

.fm-card--large {
    min-height: 340px;
}

.fm-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.fm-card-heading h2 {
    margin: 5px 0 0;
    font-size: 1.12rem;
}

.fm-badge,
.fm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: max-content;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 650;
}

.fm-badge {
    background: var(--fm-lavender);
    color: var(--fm-indigo);
}

.fm-status-pill--success {
    background: rgba(21, 128, 61, 0.10);
    color: var(--fm-success);
}

.fm-status-pill--info {
    background: rgba(37, 99, 235, 0.10);
    color: var(--fm-info);
}

.fm-status-pill--danger {
    background: rgba(220, 38, 38, 0.10);
    color: var(--fm-danger);
}

.fm-status-pill--neutral {
    background: var(--fm-surface-soft);
    color: var(--fm-text-muted);
}

.fm-status-pill svg {
    width: 16px;
    height: 16px;
}

.fm-field {
    display: grid;
    gap: 8px;
}

.fm-field label {
    color: var(--fm-text);
    font-size: 0.88rem;
    font-weight: 650;
}

.fm-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fm-muted-note {
    color: var(--fm-text-muted);
    font-size: 0.75rem;
}

.fm-input-shell {
    position: relative;
}

.fm-input-shell > svg {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--fm-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.fm-input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
    color: var(--fm-text);
    padding: 0 14px;
    outline: none;
    transition:
        border-color var(--fm-transition),
        box-shadow var(--fm-transition),
        background var(--fm-transition);
}

.fm-input-shell .fm-input {
    padding-left: 44px;
}

.fm-input::placeholder {
    color: color-mix(in srgb, var(--fm-text-muted) 75%, transparent);
}

.fm-input:focus {
    border-color: var(--fm-indigo);
    box-shadow: 0 0 0 4px var(--fm-focus);
}

.message {
    margin-bottom: 18px;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: 13px 14px;
    background: var(--fm-surface-soft);
    color: var(--fm-text);
    font-size: 0.9rem;
}

.message.error {
    border-color: color-mix(in srgb, var(--fm-danger) 32%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-danger) 8%, var(--fm-surface));
    color: var(--fm-danger);
}

.message.success {
    border-color: color-mix(in srgb, var(--fm-success) 32%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-success) 8%, var(--fm-surface));
    color: var(--fm-success);
}

.message.warning {
    border-color: color-mix(in srgb, var(--fm-warning) 32%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-warning) 8%, var(--fm-surface));
    color: var(--fm-warning);
}


.fm-input-shell--password .fm-input {
    padding-right: 48px;
}

.fm-password-toggle {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 8px;
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--fm-text-muted);
    transform: translateY(-50%);
    transition:
        background var(--fm-transition),
        color var(--fm-transition);
}

.fm-password-toggle:hover {
    background: var(--fm-surface-soft);
    color: var(--fm-text);
}

.fm-password-toggle svg {
    width: 18px;
    height: 18px;
}

.fm-toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    cursor: pointer;
    user-select: none;
}

.fm-toggle {
    position: relative;
    display: inline-flex;
}

.fm-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.fm-toggle-track {
    position: relative;
    display: inline-flex;
    width: 42px;
    height: 24px;
    align-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 999px;
    background: var(--fm-surface-soft);
    transition:
        background var(--fm-transition),
        border-color var(--fm-transition),
        box-shadow var(--fm-transition);
}

.fm-toggle-thumb {
    position: absolute;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--fm-surface);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
    transition: transform var(--fm-transition);
}

.fm-toggle-input:checked + .fm-toggle-track {
    border-color: var(--fm-indigo);
    background: var(--fm-indigo);
}

.fm-toggle-input:checked + .fm-toggle-track .fm-toggle-thumb {
    transform: translateX(18px);
}

.fm-toggle-input:focus-visible + .fm-toggle-track {
    box-shadow: 0 0 0 4px var(--fm-focus);
}

.fm-toggle-label {
    color: var(--fm-text);
    font-size: 0.84rem;
    font-weight: 550;
}


.fm-auth-inline-link,
.fm-auth-secondary-action a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--fm-indigo);
    font-size: 0.84rem;
    font-weight: 650;
    text-decoration: none;
}

.fm-auth-inline-link:hover,
.fm-auth-secondary-action a:hover {
    text-decoration: underline;
}

.fm-auth-secondary-action {
    display: flex;
    justify-content: center;
    margin-top: 18px;
}

.fm-auth-secondary-action svg {
    width: 16px;
    height: 16px;
}

.fm-password-guidance {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 14px;
    border-radius: var(--fm-radius-md);
    background: var(--fm-lavender);
    color: var(--fm-indigo);
    font-size: 0.82rem;
    line-height: 1.55;
}

.fm-password-guidance svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    margin-top: 1px;
}


.fm-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (max-width: 560px) {
    .fm-auth-grid {
        grid-template-columns: 1fr;
    }
}


.fm-page-stack {
    display: grid;
    gap: 22px;
}

.fm-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.fm-page-heading h1 {
    margin: 6px 0 6px;
    font-size: clamp(1.65rem, 3vw, 2.2rem);
}

.fm-page-heading p {
    margin: 0;
    color: var(--fm-text-muted);
}

.fm-profile-grid {
    display: grid;
    grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.65fr);
    gap: 22px;
    align-items: start;
}

.fm-profile-summary {
    display: grid;
    justify-items: center;
    gap: 18px;
    text-align: center;
}

.fm-profile-avatar {
    display: grid;
    width: 88px;
    height: 88px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 24%, var(--fm-border-color));
    border-radius: 26px;
    background: linear-gradient(135deg, var(--fm-lavender), var(--fm-surface-soft));
    color: var(--fm-indigo);
    font-size: 1.55rem;
    font-weight: 750;
    letter-spacing: -0.04em;
}

.fm-profile-summary-copy {
    display: grid;
    gap: 5px;
}

.fm-profile-summary-copy strong {
    color: var(--fm-text);
    font-size: 1.05rem;
}

.fm-profile-summary-copy span {
    color: var(--fm-text-muted);
    font-size: 0.84rem;
    word-break: break-word;
}

.fm-profile-meta {
    display: grid;
    width: 100%;
    gap: 10px;
}

.fm-profile-meta > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--fm-border-color);
    padding-top: 10px;
}

.fm-profile-meta span {
    color: var(--fm-text-muted);
    font-size: 0.8rem;
}

.fm-profile-meta strong {
    color: var(--fm-text);
    font-size: 0.84rem;
}

.fm-profile-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

@media (max-width: 820px) {
    .fm-page-heading {
        display: grid;
    }

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

@media (max-width: 560px) {
    .fm-profile-actions {
        display: grid;
    }

    .fm-profile-actions .fm-button {
        width: 100%;
    }
}


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

.fm-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: flex;
    visibility: hidden;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

.fm-modal.is-open {
    visibility: visible;
}

.fm-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.fm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(11 16 32 / 0.48);
    opacity: 0;
    backdrop-filter: blur(3px);
    transition: opacity 180ms ease;
}

.fm-modal.is-visible .fm-modal__backdrop {
    opacity: 1;
}

.fm-modal__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border: 1px solid var(--fm-border-color);
    border-radius: 16px;
    background: var(--fm-surface);
    padding: 24px;
    opacity: 0;
    box-shadow: 0 24px 70px rgb(15 23 42 / 0.22);
    transform: translateY(8px) scale(0.985);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.fm-modal.is-visible .fm-modal__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.fm-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.fm-modal__header h2 {
    margin: 5px 0 5px;
}

.fm-modal__header p {
    margin: 0;
    color: var(--fm-text-muted);
}

.fm-modal__close {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 10px;
    background: var(--fm-surface);
    color: var(--fm-text);
    cursor: pointer;
}

.fm-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 560px) {
    .fm-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .fm-modal__panel {
        width: 100%;
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .fm-modal__actions {
        display: grid;
    }

    .fm-modal__actions .fm-button {
        width: 100%;
    }
}


.fm-language-selector {
    position: relative;
    z-index: 80;
}

.fm-language-selector > summary {
    list-style: none;
}

.fm-language-selector > summary::-webkit-details-marker {
    display: none;
}

.fm-language-selector__trigger {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--fm-border-color);
    border-radius: 10px;
    background: var(--fm-surface);
    padding: 7px 10px;
    color: var(--fm-text);
    cursor: pointer;
    user-select: none;
    transition:
        border-color 160ms ease,
        background-color 160ms ease;
}

.fm-language-selector__trigger:hover {
    border-color: color-mix(in srgb, var(--fm-indigo) 34%, var(--fm-border-color));
    background: var(--fm-surface-soft);
}

.fm-language-selector__trigger svg {
    width: 14px;
    height: 14px;
    transition: transform 160ms ease;
}

.fm-language-selector[open] .fm-language-selector__trigger svg {
    transform: rotate(180deg);
}

.fm-language-flag {
    font-size: 1.05rem;
    line-height: 1;
}

.fm-language-code {
    min-width: 20px;
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.04em;
}

.fm-language-selector__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: 176px;
    gap: 4px;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
    padding: 6px;
    box-shadow: 0 18px 48px rgb(15 23 42 / 0.14);
}

.fm-language-option-form {
    margin: 0;
}

.fm-language-option {
    display: grid;
    width: 100%;
    grid-template-columns: 24px 1fr 18px;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 9px 10px;
    color: var(--fm-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.fm-language-option:hover,
.fm-language-option.is-active {
    background: var(--fm-surface-soft);
}

.fm-language-option.is-active {
    color: var(--fm-indigo);
    font-weight: 650;
}

.fm-language-option svg {
    width: 15px;
    height: 15px;
}

.fm-auth-utility-actions {
    position: fixed;
    z-index: 120;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-auth-utility-actions .fm-auth-theme-toggle {
    position: static;
}

@media (prefers-reduced-motion: reduce) {
    .fm-modal,
    .fm-modal__backdrop,
    .fm-modal__panel,
    .fm-language-selector__trigger,
    .fm-language-selector__trigger svg {
        transition: none;
    }
}


/* Global flag-only language switcher */
.fm-language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--fm-border-color);
    border-radius: 11px;
    background: var(--fm-surface);
    padding: 4px;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.fm-language-switcher__form {
    display: contents;
    margin: 0;
}

.fm-language-switcher__button {
    display: inline-grid;
    width: 38px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    opacity: 0.62;
    transition:
        opacity 160ms ease,
        background-color 160ms ease,
        transform 160ms ease,
        box-shadow 160ms ease;
}

.fm-language-switcher__button:hover {
    background: var(--fm-surface-soft);
    opacity: 1;
    transform: translateY(-1px);
}

.fm-language-switcher__button.is-active {
    background: var(--fm-lavender);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fm-indigo) 22%, transparent);
    opacity: 1;
}

.fm-language-switcher__button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--fm-indigo) 24%, transparent);
    outline-offset: 2px;
}

.fm-language-switcher__button img {
    display: block;
    width: 27px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgb(15 23 42 / 0.08);
}

/* Polished Tom Select controls, shared across FinMate */
.ts-wrapper {
    width: 100%;
    font: inherit;
}

.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    min-height: 50px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--fm-border-color);
    border-radius: 10px;
    background: var(--fm-surface);
    padding: 0 42px 0 14px;
    color: var(--fm-text);
    font: inherit;
    line-height: 1.25;
    box-shadow: none;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease,
        background-color 160ms ease;
}

.ts-wrapper.single .ts-control::after {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--fm-text-muted);
    border-bottom: 2px solid var(--fm-text-muted);
    content: "";
    transform: translateY(-65%) rotate(45deg);
    transition: transform 160ms ease;
    pointer-events: none;
}

.ts-wrapper.single.dropdown-active .ts-control::after {
    transform: translateY(-25%) rotate(225deg);
}

.ts-wrapper.focus .ts-control {
    border-color: var(--fm-indigo);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fm-indigo) 14%, transparent);
}

.ts-wrapper .ts-control > input {
    min-width: 4px;
    color: var(--fm-text);
    font: inherit;
}

.ts-wrapper .ts-control .item {
    color: var(--fm-text);
}

.ts-dropdown {
    z-index: 300;
    margin-top: 7px;
    overflow: hidden;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
    color: var(--fm-text);
    box-shadow: 0 18px 48px rgb(15 23 42 / 0.14);
}

.ts-dropdown .dropdown-input-wrap {
    border-bottom: 1px solid var(--fm-border-color);
    padding: 8px;
}

.ts-dropdown .dropdown-input {
    min-height: 40px;
    border: 1px solid var(--fm-border-color);
    border-radius: 8px;
    background: var(--fm-surface-soft);
    padding: 0 11px;
    color: var(--fm-text);
    font: inherit;
    outline: 0;
}

.ts-dropdown .option,
.ts-dropdown .optgroup-header,
.ts-dropdown .create {
    padding: 10px 12px;
}

.ts-dropdown .option {
    margin: 3px 5px;
    border-radius: 8px;
    color: var(--fm-text);
}

.ts-dropdown .active {
    background: var(--fm-lavender);
    color: var(--fm-indigo);
}

.ts-dropdown .selected {
    font-weight: 650;
}

html[data-theme="dark"] .ts-wrapper.single .ts-control,
html[data-theme="dark"] .ts-wrapper.multi .ts-control,
html[data-theme="dark"] .ts-dropdown {
    background: var(--fm-surface);
}

html[data-theme="dark"] .ts-dropdown .active {
    background: color-mix(in srgb, var(--fm-indigo) 22%, var(--fm-surface));
    color: var(--fm-text);
}

@media (prefers-reduced-motion: reduce) {
    .fm-language-switcher__button,
    .ts-wrapper.single .ts-control,
    .ts-wrapper.single .ts-control::after {
        transition: none;
    }
}
/* Step 2.7 select visual refinement */
.fm-select-shell {
    position: relative;
}

.fm-select-shell > svg {
    position: absolute;
    z-index: 4;
    top: 50%;
    left: 15px;
    width: 18px;
    height: 18px;
    color: var(--fm-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.fm-select-input.ts-wrapper {
    width: 100%;
    height: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.fm-select-input.ts-wrapper.single .ts-control {
    min-height: 50px;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
    padding: 0 44px 0 44px;
    box-shadow: none;
}

.fm-select-input.ts-wrapper.single .ts-control:hover {
    border-color: color-mix(
        in srgb,
        var(--fm-text-muted) 48%,
        var(--fm-border-color)
    );
}

.fm-select-input.ts-wrapper.focus .ts-control,
.fm-select-input.ts-wrapper.dropdown-active .ts-control {
    border-color: var(--fm-indigo);
    box-shadow: 0 0 0 4px var(--fm-focus);
}

.fm-select-input.ts-wrapper.single .ts-control::after {
    right: 18px;
    width: 7px;
    height: 7px;
    border-right-width: 1.75px;
    border-bottom-width: 1.75px;
}

.fm-select-input.ts-wrapper .ts-control .item {
    display: flex;
    min-width: 0;
    align-items: center;
    color: var(--fm-text);
    font-size: 0.95rem;
    font-weight: 520;
}

.fm-select-input.ts-wrapper .ts-control > input {
    font-size: 0.95rem;
}

.fm-select-input.ts-wrapper .ts-dropdown {
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
    box-shadow:
        0 20px 46px rgb(15 23 42 / 0.14),
        0 4px 12px rgb(15 23 42 / 0.05);
}

.fm-select-input.ts-wrapper .ts-dropdown-content {
    max-height: 240px;
    padding: 5px;
}

.fm-select-input.ts-wrapper .ts-dropdown .option {
    margin: 0;
    border-radius: 8px;
    padding: 10px 11px;
    font-size: 0.92rem;
}

.fm-select-input.ts-wrapper .ts-dropdown .option + .option {
    margin-top: 2px;
}

.fm-select-input.ts-wrapper .ts-dropdown .active {
    background: var(--fm-lavender);
    color: var(--fm-indigo);
}

.fm-select-input.ts-wrapper .ts-dropdown .selected {
    position: relative;
    padding-right: 34px;
    font-weight: 650;
}

.fm-select-input.ts-wrapper .ts-dropdown .selected::after {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 7px;
    height: 4px;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    content: "";
    transform: translateY(-65%) rotate(-45deg);
}

.fm-select-input.ts-wrapper.plugin-dropdown_input .dropdown-input-wrap {
    border-bottom: 1px solid var(--fm-border-color);
    padding: 8px;
}

.fm-select-input.ts-wrapper.plugin-dropdown_input .dropdown-input {
    min-height: 38px;
    border: 1px solid var(--fm-border-color);
    border-radius: 8px;
    background: var(--fm-surface-soft);
    padding: 0 10px;
}

.fm-select-input.ts-wrapper:not(.plugin-dropdown_input) .dropdown-input-wrap {
    display: none;
}

html[data-theme="dark"] .fm-select-input.ts-wrapper.single .ts-control,
html[data-theme="dark"] .fm-select-input.ts-wrapper .ts-dropdown {
    background: var(--fm-surface);
}

@media (prefers-reduced-motion: reduce) {
    .fm-select-input.ts-wrapper.single .ts-control,
    .fm-select-input.ts-wrapper.single .ts-control::after {
        transition: none;
    }
}

/* Module 3.2 — Google OAuth authentication */
.fm-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fm-auth-divider::before,
.fm-auth-divider::after {
    height: 1px;
    flex: 1;
    background: var(--fm-border-color);
    content: "";
}

.fm-button--oauth {
    justify-content: center;
    border: 1px solid var(--fm-border-color);
    background: var(--fm-surface);
    color: var(--fm-text);
}

.fm-button--oauth:hover {
    border-color: color-mix(
        in srgb,
        var(--fm-indigo) 36%,
        var(--fm-border-color)
    );
    background: var(--fm-surface-soft);
    color: var(--fm-text);
}

.fm-google-mark {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 50%;
    background: var(--fm-surface);
    color: #4285f4;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1;
}

/* Module 3.3 — Profile Google connection security */
.fm-google-security-card {
    display: grid;
    gap: 18px;
}

.fm-google-security-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.fm-google-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--fm-border-color);
    border-radius: 999px;
    background: var(--fm-surface-soft);
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.fm-google-status-badge.is-connected {
    border-color: color-mix(in srgb, #15803d 25%, transparent);
    background: color-mix(in srgb, #15803d 8%, var(--fm-surface));
    color: #15803d;
}

.fm-google-connection-status {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.fm-google-connection-status p {
    margin: 5px 0;
    color: var(--fm-text-muted);
}

.fm-google-connection-status small {
    color: var(--fm-text-muted);
}

.fm-google-security-form {
    display: grid;
    max-width: 560px;
    gap: 14px;
}

@media (max-width: 640px) {
    .fm-google-security-heading {
        flex-direction: column;
    }
}

/* Module 4.2A — compact security cards + TOTP enrollment refinement */
.fm-security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 20px;
}

.fm-security-grid > .fm-card {
    min-width: 0;
    margin: 0;
}

.fm-mfa-security-card,
.fm-google-security-card {
    display: grid;
    gap: 16px;
    padding: 20px;
}

.fm-security-grid .fm-google-security-heading {
    align-items: flex-start;
    gap: 12px;
}

.fm-security-grid .fm-google-security-heading h2 {
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.fm-security-grid .fm-google-security-heading p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.fm-security-grid .fm-google-connection-status {
    margin: 0;
}

.fm-security-grid .fm-google-security-form {
    gap: 12px;
}

.fm-modal__panel--mfa {
    width: min(790px, calc(100vw - 32px));
}

.fm-mfa-enrollment {
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
    gap: 26px;
    align-items: start;
}

.fm-mfa-qr-column,
.fm-mfa-setup-column {
    min-width: 0;
}

.fm-mfa-step-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.fm-mfa-step-label > span {
    display: inline-grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 999px;
    background: var(--fm-primary-soft, #EEF2FF);
    color: var(--fm-primary, #4F46E5);
    font-size: 0.78rem;
    font-weight: 800;
}

.fm-mfa-qr-frame {
    display: grid;
    width: 100%;
    min-height: 258px;
    place-items: center;
    padding: 14px;
    border: 1px solid var(--fm-border-color);
    border-radius: 18px;
    background: #FFFFFF;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.fm-mfa-qr-frame img {
    display: block;
    width: min(230px, 100%);
    height: auto;
    aspect-ratio: 1;
}

.fm-mfa-qr-unavailable {
    display: grid;
    max-width: 210px;
    gap: 10px;
    place-items: center;
    color: var(--fm-text-muted);
    text-align: center;
}

.fm-mfa-qr-unavailable svg {
    width: 42px;
    height: 42px;
}

.fm-mfa-qr-help {
    margin: 10px 4px 0;
    text-align: center;
}

.fm-mfa-secret {
    display: grid;
    gap: 8px;
    padding: 13px 14px;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface-soft);
}

.fm-mfa-secret > span {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.fm-mfa-secret-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fm-mfa-secret-row code {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    color: var(--fm-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.86rem;
    letter-spacing: 0.055em;
}

.fm-icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 10px;
    background: var(--fm-surface);
    color: var(--fm-text);
    cursor: pointer;
}

.fm-icon-button:hover {
    border-color: rgba(79, 70, 229, 0.32);
    color: var(--fm-primary, #4F46E5);
}

.fm-button--fit {
    width: fit-content;
}

.fm-button--ghost {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.fm-mfa-confirm-form {
    margin-top: 18px;
}

.fm-mfa-code-input {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.18em;
}

.fm-mfa-start,
.fm-mfa-enabled-summary {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 15px;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface-soft);
}

.fm-mfa-start p,
.fm-mfa-enabled-summary p {
    margin: 4px 0 0;
    color: var(--fm-text-muted);
    line-height: 1.55;
}

.fm-mfa-start-icon,
.fm-mfa-enabled-icon {
    display: inline-grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: var(--fm-primary-soft, #EEF2FF);
    color: var(--fm-primary, #4F46E5);
}

.fm-recovery-warning {
    display: flex;
    gap: 12px;
    padding: 15px 16px;
    border: 1px solid rgba(180, 83, 9, 0.22);
    border-radius: 14px;
    background: rgba(180, 83, 9, 0.07);
}

.fm-recovery-warning p {
    margin: 4px 0 0;
    color: var(--fm-text-muted);
}

.fm-recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.fm-recovery-grid code {
    overflow-wrap: anywhere;
    padding: 11px 12px;
    border: 1px solid var(--fm-border-color);
    border-radius: 10px;
    background: var(--fm-surface-soft);
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.05em;
}

.fm-mfa-manage-grid {
    display: grid;
    gap: 12px;
}

.fm-security-details {
    padding: 14px 0;
    border-top: 1px solid var(--fm-border-color);
}

.fm-security-details summary {
    cursor: pointer;
    font-weight: 700;
}

.fm-security-details[open] summary {
    margin-bottom: 14px;
}

.fm-security-details--danger summary {
    color: #DC2626;
}

@media (max-width: 980px) {
    .fm-security-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .fm-mfa-enrollment {
        grid-template-columns: 1fr;
    }

    .fm-modal__panel--mfa {
        width: min(620px, calc(100vw - 20px));
    }
}

@media (max-width: 640px) {
    .fm-recovery-grid {
        grid-template-columns: 1fr;
    }

    .fm-mfa-security-card,
    .fm-google-security-card {
        padding: 17px;
    }

    .fm-mfa-qr-frame {
        min-height: 238px;
    }
}

/* Module 4.3 — login MFA challenge */
.fm-mfa-login-heading {
    margin-bottom: 22px;
}

.fm-mfa-login-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 13px 14px;
    border: 1px solid rgba(21, 128, 61, 0.18);
    border-radius: 14px;
    background: rgba(21, 128, 61, 0.06);
}

.fm-mfa-login-status__icon {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: rgba(21, 128, 61, 0.1);
    color: #15803D;
}

.fm-mfa-login-status > div:last-child {
    display: grid;
    gap: 2px;
}

.fm-mfa-login-status span {
    color: var(--fm-text-muted);
    font-size: 0.82rem;
}

.fm-mfa-login-code {
    font-weight: 750;
    letter-spacing: 0.2em;
}

.fm-mfa-recovery-login {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--fm-border-color);
}

.fm-mfa-recovery-login summary {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fm-primary, #4F46E5);
    font-weight: 700;
    cursor: pointer;
}

.fm-mfa-recovery-login[open] summary {
    margin-bottom: 10px;
}

.fm-mfa-recovery-login > p {
    margin: 0 0 14px;
    color: var(--fm-text-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.fm-mfa-cancel-link {
    display: block;
    margin-top: 18px;
    text-align: center;
}


/* Financial account management */
.fm-account-form-card {
    margin-inline: auto;
    max-width: 1040px;
    padding: clamp(1.25rem, 2vw, 1.75rem);
}

.fm-account-form-card .fm-card-heading {
    margin-bottom: 1rem;
}

.fm-account-form {
    gap: 1rem;
}

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

.fm-account-form-grid--secondary {
    align-items: start;
    grid-template-columns: minmax(180px, 0.65fr) minmax(280px, 1.35fr);
}

.fm-account-default-field {
    align-content: start;
}

.fm-switch-control {
    align-items: center;
    align-self: start;
    background: transparent;
    border: 0;
    color: var(--fm-text-muted);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    gap: 0.65rem;
    min-height: 2.5rem;
    padding: 0;
}

.fm-switch-track {
    background: var(--fm-border);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fm-text-muted) 14%, transparent);
    display: inline-flex;
    flex: 0 0 auto;
    height: 1.65rem;
    padding: 0.18rem;
    transition:
        background var(--fm-transition),
        box-shadow var(--fm-transition);
    width: 3rem;
}

.fm-switch-thumb {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
    display: block;
    height: 1.29rem;
    transform: translateX(0);
    transition: transform var(--fm-transition);
    width: 1.29rem;
}

.fm-switch-control.is-on {
    color: var(--fm-success);
}

.fm-switch-control.is-on .fm-switch-track {
    background: var(--fm-success);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fm-success) 65%, transparent);
}

.fm-switch-control.is-on .fm-switch-thumb {
    transform: translateX(1.35rem);
}

.fm-switch-control:focus-visible {
    border-radius: 999px;
    outline: 3px solid var(--fm-focus);
    outline-offset: 4px;
}

.fm-account-notes-field textarea.fm-textarea {
    box-sizing: border-box;
    height: auto;
    line-height: 1.55;
    min-height: 150px;
    padding: 0.85rem 0.95rem;
    resize: vertical;
}

.fm-account-form .fm-muted-note {
    line-height: 1.45;
}

.fm-account-form .fm-form-actions {
    border-top: 1px solid var(--fm-border);
    margin-top: 0.15rem;
    padding-top: 1rem;
}

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

.fm-account-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fm-account-card__top,
.fm-account-card__actions {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.fm-account-card__identity {
    display: grid;
    gap: 0.2rem;
}

.fm-account-card__identity strong {
    font-size: 1.05rem;
}

.fm-account-card__meta {
    color: var(--fm-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
}

.fm-account-card__meta span {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
}

.fm-account-empty {
    align-items: center;
    display: grid;
    gap: 0.8rem;
    justify-items: center;
    padding: 2rem 1rem;
    text-align: center;
}

.fm-account-empty > svg {
    height: 2rem;
    width: 2rem;
}

.fm-form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (max-width: 760px) {
    .fm-account-form-card {
        max-width: none;
    }

    .fm-account-form-grid,
    .fm-account-form-grid--secondary,
    .fm-account-grid {
        grid-template-columns: 1fr;
    }

    .fm-account-card__top,
    .fm-account-card__actions {
        align-items: stretch;
        flex-direction: column;
    }
}



.fm-admin-icon-label {
    align-items: center;
    display: inline-flex;
    gap: 0.45rem;
}

.fm-admin-icon-label > svg {
    height: 1rem;
    width: 1rem;
}


/* Module 9.3 — Budget workspace */
.fm-budget-heading {
    align-items: center;
}

.fm-budget-month-nav {
    align-items: center;
    display: flex;
    gap: 0.65rem;
}

.fm-budget-month-chip {
    align-items: center;
    background: var(--fm-surface);
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    box-shadow: var(--fm-shadow-sm);
    color: var(--fm-text);
    display: inline-flex;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0 0.9rem;
}

.fm-budget-month-chip svg {
    color: var(--fm-primary);
    height: 18px;
    width: 18px;
}

.fm-budget-progress-card {
    display: grid;
    gap: 1rem;
}

.fm-budget-progress-copy {
    align-items: end;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.fm-budget-progress-copy h2 {
    margin: 0.3rem 0 0;
}

.fm-budget-progress-copy > strong {
    color: var(--fm-primary);
    font-size: 1.4rem;
}

.fm-budget-progress {
    background: var(--fm-surface-soft);
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.fm-budget-progress > span {
    background: linear-gradient(90deg, var(--fm-indigo), var(--fm-teal));
    border-radius: inherit;
    display: block;
    height: 100%;
    transition: width var(--fm-transition);
}

.fm-budget-help {
    align-items: flex-start;
    color: var(--fm-text-muted);
    display: flex;
    font-size: 0.82rem;
    gap: 0.5rem;
    line-height: 1.5;
    margin: 0;
}

.fm-budget-help svg {
    flex: 0 0 auto;
    height: 17px;
    margin-top: 1px;
    width: 17px;
}

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

.fm-budget-section-copy {
    color: var(--fm-text-muted);
    line-height: 1.55;
    margin: -0.3rem 0 1.2rem;
}

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

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

.fm-budget-inline-action {
    border-top: 1px solid var(--fm-border-color);
    margin-top: 1rem;
    padding-top: 1rem;
}

.fm-budget-category-form {
    align-items: end;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.7fr) auto auto;
    margin-bottom: 1.4rem;
}

.fm-budget-derived-currency {
    display: grid;
    gap: 0.45rem;
    min-width: 90px;
}

.fm-budget-derived-currency span {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.fm-budget-derived-currency strong {
    align-items: center;
    display: flex;
    min-height: 50px;
}

.fm-budget-callout {
    align-items: flex-start;
    background: color-mix(in srgb, var(--fm-warning) 7%, var(--fm-surface));
    border: 1px solid color-mix(in srgb, var(--fm-warning) 25%, var(--fm-border-color));
    border-radius: var(--fm-radius-md);
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.25rem;
    padding: 1rem;
}

.fm-budget-callout > svg {
    color: var(--fm-warning);
    flex: 0 0 auto;
    height: 20px;
    margin-top: 2px;
    width: 20px;
}

.fm-budget-callout p {
    color: var(--fm-text-muted);
    line-height: 1.5;
    margin: 0.3rem 0 0;
}

.fm-budget-category-list {
    border-top: 1px solid var(--fm-border-color);
    display: grid;
}

.fm-budget-category-row {
    align-items: center;
    border-bottom: 1px solid var(--fm-border-color);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 0;
}

.fm-budget-category-identity,
.fm-budget-category-amount {
    align-items: center;
    display: flex;
    gap: 0.8rem;
}

.fm-budget-category-icon {
    align-items: center;
    background: var(--fm-lavender);
    border-radius: 11px;
    color: var(--fm-indigo);
    display: inline-flex;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.fm-budget-category-icon svg {
    height: 19px;
    width: 19px;
}

.fm-budget-category-identity > div {
    display: grid;
    gap: 0.2rem;
}

.fm-budget-category-identity small {
    color: var(--fm-text-muted);
    font-size: 0.76rem;
}

.fm-budget-category-amount form {
    margin: 0;
}

.fm-budget-empty {
    border-top: 1px solid var(--fm-border-color);
    margin-top: 0.5rem;
}

@media (max-width: 980px) {
    .fm-budget-settings-grid,
    .fm-budget-category-form {
        grid-template-columns: 1fr;
    }

    .fm-budget-derived-currency {
        grid-template-columns: auto 1fr;
    }

    .fm-budget-derived-currency strong {
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .fm-budget-heading,
    .fm-budget-progress-copy,
    .fm-budget-category-row,
    .fm-budget-category-amount {
        align-items: stretch;
        flex-direction: column;
    }

    .fm-budget-month-nav {
        width: 100%;
    }

    .fm-budget-month-chip {
        flex: 1;
        justify-content: center;
    }

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

    .fm-budget-category-amount {
        gap: 0.6rem;
    }

    .fm-budget-category-amount .fm-icon-button {
        width: 100%;
    }
}


/* Global submit loading state */
button.is-submit-loading,
input.is-submit-loading {
    cursor: wait;
    opacity: 0.78;
    pointer-events: none;
}

button.is-submit-loading {
    align-items: center;
    display: inline-flex;
    gap: 0.55rem;
}

button.is-submit-loading::after {
    animation: fm-submit-spin 0.7s linear infinite;
    border: 2px solid currentColor;
    border-radius: 999px;
    border-right-color: transparent;
    content: "";
    flex: 0 0 auto;
    height: 0.9rem;
    width: 0.9rem;
}

form.is-submitting {
    cursor: progress;
}

@keyframes fm-submit-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    button.is-submit-loading::after {
        animation-duration: 1.4s;
    }
}


/* Module 10.3 — Expense CRUD */
.fm-expense-form-grid,
.fm-expense-filter-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fm-expense-filter-grid .fm-form-actions {
    align-items: end;
}

@media (max-width: 980px) {
    .fm-expense-form-grid,
    .fm-expense-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .fm-expense-form-grid,
    .fm-expense-filter-grid {
        grid-template-columns: 1fr;
    }
}


/* Module 10.3 — Expense workspace UI polish */
.fm-input-shell {
    position: relative;
}

.fm-input-shell > svg {
    position: absolute;
    z-index: 3;
    top: 50%;
    left: 15px;
    width: 18px;
    height: 18px;
    color: var(--fm-text-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.fm-input-shell > .fm-input,
.fm-input-shell > .flatpickr-input + .fm-input,
.fm-input-shell > .flatpickr-input + input {
    padding-left: 44px;
}

.fm-input-shell .flatpickr-input[readonly] {
    cursor: pointer;
}

.fm-expense-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.fm-expense-summary-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-lg);
    padding: 19px;
    box-shadow: var(--fm-shadow-sm);
}

.fm-expense-summary-card > div:last-child {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.fm-expense-summary-card span,
.fm-expense-summary-card small {
    color: var(--fm-text-muted);
}

.fm-expense-summary-card span {
    font-size: 0.77rem;
    font-weight: 650;
}

.fm-expense-summary-card strong {
    overflow: hidden;
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-expense-summary-card small {
    font-size: 0.72rem;
}

.fm-expense-summary-icon {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: rgb(255 255 255 / 0.64);
}

.fm-expense-summary-icon svg {
    width: 21px;
    height: 21px;
}

.fm-expense-summary-card--indigo {
    background: color-mix(in srgb, var(--fm-indigo) 8%, var(--fm-surface));
}

.fm-expense-summary-card--indigo .fm-expense-summary-icon {
    color: var(--fm-indigo);
}

.fm-expense-summary-card--teal {
    background: color-mix(in srgb, var(--fm-teal) 8%, var(--fm-surface));
}

.fm-expense-summary-card--teal .fm-expense-summary-icon {
    color: var(--fm-teal);
}

.fm-expense-summary-card--coral {
    background: color-mix(in srgb, var(--fm-coral) 8%, var(--fm-surface));
}

.fm-expense-summary-card--coral .fm-expense-summary-icon {
    color: var(--fm-coral);
}

.fm-expense-summary-card--sage {
    background: color-mix(in srgb, var(--fm-success) 7%, var(--fm-surface));
}

.fm-expense-summary-card--sage .fm-expense-summary-icon {
    color: var(--fm-success);
}

.fm-expense-budget-progress {
    display: grid;
    gap: 14px;
    padding-block: 20px;
}

.fm-expense-budget-progress__heading,
.fm-expense-budget-progress__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.fm-expense-budget-progress__heading h2 {
    margin: 4px 0 0;
    font-size: 1.05rem;
}

.fm-expense-budget-progress__heading > strong {
    color: var(--fm-indigo);
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}

.fm-expense-budget-progress__meta {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
}

.fm-expense-summary-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.fm-expense-summary-note svg {
    width: 15px;
    height: 15px;
}

.fm-expense-filter-card {
    padding: 22px 24px;
}

.fm-expense-filter-heading {
    margin-bottom: 18px;
}

.fm-expense-filter-grid {
    align-items: end;
    grid-template-columns: minmax(240px, 1.35fr) repeat(2, minmax(180px, 1fr));
}

.fm-expense-filter-search {
    grid-column: span 1;
}

.fm-expense-filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 1 / -1;
    padding-top: 2px;
}

.fm-expense-table-card .fm-card-heading {
    margin-bottom: 12px;
}

.fm-expense-filter-card .fm-select-input.ts-wrapper.single .ts-control,
.fm-expense-filter-card .fm-input {
    min-height: 50px;
}

.flatpickr-calendar {
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface);
    box-shadow:
        0 20px 46px rgb(15 23 42 / 0.14),
        0 4px 12px rgb(15 23 42 / 0.05);
}

.flatpickr-calendar .flatpickr-months,
.flatpickr-calendar .flatpickr-weekdays {
    background: transparent;
}

.flatpickr-calendar .flatpickr-day {
    border-radius: 9px;
}

.flatpickr-calendar .flatpickr-day.selected,
.flatpickr-calendar .flatpickr-day.startRange,
.flatpickr-calendar .flatpickr-day.endRange {
    border-color: var(--fm-indigo);
    background: var(--fm-indigo);
}

.flatpickr-calendar .flatpickr-day.today {
    border-color: var(--fm-indigo);
}

html[data-theme="dark"] .fm-expense-summary-icon {
    background: rgb(11 16 32 / 0.38);
}

html[data-theme="dark"] .flatpickr-calendar,
html[data-theme="dark"] .flatpickr-months,
html[data-theme="dark"] .flatpickr-month,
html[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months,
html[data-theme="dark"] .flatpickr-current-month input.cur-year,
html[data-theme="dark"] span.flatpickr-weekday {
    background: var(--fm-surface);
    color: var(--fm-text);
}

html[data-theme="dark"] .flatpickr-day {
    color: var(--fm-text);
}

html[data-theme="dark"] .flatpickr-day.prevMonthDay,
html[data-theme="dark"] .flatpickr-day.nextMonthDay {
    color: var(--fm-text-muted);
}

@media (max-width: 1180px) {
    .fm-expense-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .fm-expense-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .fm-expense-summary-grid,
    .fm-expense-filter-grid {
        grid-template-columns: 1fr;
    }

    .fm-expense-budget-progress__heading,
    .fm-expense-budget-progress__meta,
    .fm-expense-filter-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .fm-expense-filter-actions .fm-button {
        width: 100%;
        justify-content: center;
    }
}


/* Module 11.3 — descriptive tags and advanced expense filtering */
.fm-field-heading-row{display:flex;align-items:center;justify-content:space-between;gap:.75rem}.fm-text-link{font-size:.82rem;font-weight:700;color:var(--fm-primary,#4f46e5);text-decoration:none}.fm-text-link:hover{text-decoration:underline}.fm-field-help{display:block;margin-top:.4rem;color:var(--fm-text-muted,#64748b);font-size:.78rem}.fm-tag-create-form{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:1rem}.fm-tag-list{display:grid;gap:.75rem}.fm-tag-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.9rem 1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:14px;background:var(--fm-surface,#fff)}.fm-tag-row.is-deleted{opacity:.7}.fm-tag-actions{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}.fm-tag-actions .fm-inline-form{display:flex;align-items:center;gap:.5rem}.fm-tag-pill{display:inline-flex;align-items:center;gap:.38rem;padding:.38rem .65rem;border-radius:999px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary-deep,#4338ca);font-size:.82rem;font-weight:700}.fm-tag-pill svg{width:14px;height:14px}.fm-tag-pill small{font-size:.68rem;opacity:.75}.fm-tag-pill--compact{padding:.22rem .5rem;font-size:.72rem;margin:.18rem .2rem .05rem 0}.fm-table-tags{margin-top:.3rem;display:flex;gap:.25rem;flex-wrap:wrap}.fm-select-shell--multi>.ts-wrapper{min-height:44px}.fm-select-shell--multi .ts-control{flex-wrap:wrap}.fm-input--compact{min-height:36px;padding:.45rem .65rem}.fm-expense-filter-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.fm-expense-filter-search{grid-column:span 2}
html[data-theme="dark"] .fm-tag-row{background:var(--fm-surface,#111827)}html[data-theme="dark"] .fm-tag-pill{background:rgba(79,70,229,.18);color:#c7d2fe}
@media(max-width:1050px){.fm-expense-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:720px){.fm-tag-create-form,.fm-expense-filter-grid{grid-template-columns:1fr}.fm-expense-filter-search{grid-column:span 1}.fm-tag-row{align-items:flex-start;flex-direction:column}.fm-tag-actions,.fm-tag-actions .fm-inline-form{width:100%}.fm-tag-actions .fm-inline-form .fm-input{flex:1}}

/* Module 11.3 final UI corrective — direct expense edit shortcut */
.fm-expense-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    white-space: nowrap;
}

.fm-expense-edit-shortcut {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
}


/* Module 12 recurring expense workspace */
.fm-recurring-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.fm-recurring-slots { display: grid; gap: 1rem; }
.fm-recurring-slot {
    border: 1px solid var(--fm-border, #e2e8f0);
    border-radius: 1rem;
    padding: 1rem;
    background: var(--fm-surface, #fff);
}
.fm-recurring-slot__head,
.fm-recurring-slot__head > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.fm-recurring-exception-grid { display: grid; gap: .75rem; margin-top: .9rem; }
.fm-inline-form { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.fm-inline-form--wide { display: grid; grid-template-columns: minmax(8rem, .7fr) 1fr 1fr auto; }
.fm-inline-form .fm-input,
.fm-inline-form .fm-select-input { min-width: 0; }
@media (max-width: 900px) {
    .fm-recurring-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fm-inline-form--wide { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .fm-recurring-summary-grid { grid-template-columns: 1fr; }
    .fm-inline-form--wide { grid-template-columns: 1fr; }
}


/* Module 12.4 UI polish — unified expense recurrence editor */
.fm-recurring-editor {
    overflow: hidden;
    margin-top: 1.15rem;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 16%, var(--fm-border-color));
    border-radius: var(--fm-radius-lg);
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
    transition:
        border-color var(--fm-transition),
        background var(--fm-transition),
        box-shadow var(--fm-transition);
}

.fm-recurring-editor[hidden],
.fm-recurring-editor [hidden] {
    display: none !important;
}

.fm-recurring-editor__heading {
    display: flex;
    min-height: 82px;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.1rem 1.2rem;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--fm-indigo) 7%, var(--fm-surface)),
        color-mix(in srgb, var(--fm-teal) 4%, var(--fm-surface))
    );
}

.fm-recurring-editor__identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .9rem;
}

.fm-recurring-editor__identity > div {
    display: grid;
    min-width: 0;
    gap: .2rem;
}

.fm-recurring-editor__icon,
.fm-recurring-scope__icon,
.fm-recurring-end-card__icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--fm-indigo) 11%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-recurring-editor__icon {
    width: 42px;
    height: 42px;
}

.fm-recurring-editor__icon svg {
    width: 20px;
    height: 20px;
}

.fm-recurring-editor__heading small,
.fm-recurring-editor__section-heading small {
    color: var(--fm-text-muted);
    line-height: 1.45;
}

.fm-recurring-editor.is-one-time {
    border-color: var(--fm-border-color);
    box-shadow: none;
}

.fm-recurring-editor.is-one-time .fm-recurring-editor__heading {
    background: var(--fm-surface-soft);
}

.fm-recurring-scope {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .9rem;
    border-top: 1px solid var(--fm-border-color);
    padding: 1rem 1.2rem;
    background: color-mix(in srgb, var(--fm-info) 4%, var(--fm-surface));
}

.fm-recurring-scope__icon {
    width: 38px;
    height: 38px;
    background: color-mix(in srgb, var(--fm-info) 10%, var(--fm-surface));
    color: var(--fm-info);
}

.fm-recurring-scope__icon svg,
.fm-recurring-end-card__icon svg {
    width: 18px;
    height: 18px;
}

.fm-recurring-editor__fields {
    display: grid;
    gap: 1rem;
    border-top: 1px solid var(--fm-border-color);
    padding: 1.15rem 1.2rem 1.2rem;
}

.fm-recurring-editor__section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.fm-recurring-editor__section-heading > div {
    display: grid;
    gap: .2rem;
}

.fm-recurring-editor__section-heading strong {
    color: var(--fm-text);
    font-size: .95rem;
}

.fm-recurring-editor__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 1rem;
}

.fm-recurring-editor__grid .fm-field,
.fm-recurring-end-card .fm-field {
    min-width: 0;
}

.fm-recurring-editor__grid .fm-select-input.ts-wrapper.single .ts-control,
.fm-recurring-scope .fm-select-input.ts-wrapper.single .ts-control {
    min-height: 50px;
}

.fm-recurring-editor__end-options {
    min-height: 64px;
}

.fm-recurring-end-card,
.fm-recurring-end-note {
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface-soft);
}

.fm-recurring-end-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .9rem;
    padding: .95rem 1rem;
}

.fm-recurring-end-card__icon {
    width: 38px;
    height: 38px;
}

.fm-recurring-end-note {
    display: flex;
    min-height: 64px;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    color: var(--fm-text-muted);
    font-size: .84rem;
}

.fm-recurring-end-note svg {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    color: var(--fm-teal);
}

.fm-recurring-editor__note {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    border-top: 1px solid var(--fm-border-color);
    padding-top: .9rem;
    color: var(--fm-text-muted);
    font-size: .78rem;
    line-height: 1.5;
}

.fm-recurring-editor__note svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    margin-top: .1rem;
    color: var(--fm-indigo);
}

.fm-recurring-editor__note p {
    margin: 0;
}

.fm-recurring-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-top: .35rem;
    border-radius: 999px;
    padding: .2rem .5rem;
    background: color-mix(in srgb, var(--fm-indigo) 12%, transparent);
    color: var(--fm-indigo-deep, #4338CA);
    font-size: .75rem;
    font-weight: 700;
}

html[data-theme="dark"] .fm-recurring-editor__heading {
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--fm-indigo) 13%, var(--fm-surface)),
        color-mix(in srgb, var(--fm-teal) 8%, var(--fm-surface))
    );
}

html[data-theme="dark"] .fm-recurring-editor.is-one-time .fm-recurring-editor__heading {
    background: var(--fm-surface-soft);
}

html[data-theme="dark"] .fm-recurring-pill {
    color: #C7D2FE;
}

@media (max-width: 980px) {
    .fm-recurring-editor__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fm-recurring-editor__grid .fm-field:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .fm-recurring-editor__heading {
        min-height: 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .fm-recurring-editor__heading .fm-switch-control {
        width: 100%;
        justify-content: space-between;
    }

    .fm-recurring-editor__grid {
        grid-template-columns: 1fr;
    }

    .fm-recurring-editor__grid .fm-field:last-child {
        grid-column: auto;
    }

    .fm-recurring-scope,
    .fm-recurring-end-card {
        grid-template-columns: 1fr;
    }

    .fm-recurring-scope__icon,
    .fm-recurring-end-card__icon {
        display: none;
    }
}

/* Module 12.4 recurring schedule workspace refinement */
.fm-page-header--recurring {
    align-items: flex-end;
}

.fm-recurring-workspace {
    display: grid;
    gap: 1rem;
}

.fm-recurring-rule-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-lg);
    padding: 1.15rem 1.2rem;
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
}

.fm-recurring-rule-card__main {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 1rem;
}

.fm-recurring-rule-card__icon {
    display: inline-grid;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--fm-indigo) 11%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-recurring-rule-card__icon svg {
    width: 21px;
    height: 21px;
}

.fm-recurring-rule-card__copy {
    display: grid;
    min-width: 0;
    gap: .55rem;
}

.fm-recurring-rule-card__title-row {
    display: flex;
    align-items: center;
    gap: .7rem;
    flex-wrap: wrap;
}

.fm-recurring-rule-card__title-row h2 {
    margin: 0;
    color: var(--fm-text);
    font-size: 1rem;
}

.fm-recurring-rule-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem 1rem;
    color: var(--fm-text-muted);
    font-size: .82rem;
}

.fm-recurring-rule-card__meta span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.fm-recurring-rule-card__meta svg {
    width: 15px;
    height: 15px;
}

.fm-recurring-rule-card__meta strong {
    color: var(--fm-text);
}

.fm-recurring-rule-card__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}

.fm-button--compact {
    min-height: 38px;
    padding: .55rem .8rem;
    font-size: .82rem;
}

.fm-recurring-empty-card .fm-empty-state {
    min-height: 260px;
}

.fm-recurring-form-shell,
.fm-recurring-rule-form {
    display: grid;
    gap: 1rem;
}

.fm-recurring-form-section {
    display: grid;
    gap: 1.15rem;
}

.fm-recurring-form-section__heading {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    border-bottom: 1px solid var(--fm-border-color);
    padding-bottom: 1rem;
}

.fm-recurring-form-section__heading > div:last-child {
    display: grid;
    gap: .18rem;
}

.fm-recurring-form-section__heading h2,
.fm-recurring-form-section__heading p {
    margin: 0;
}

.fm-recurring-form-section__heading h2 {
    color: var(--fm-text);
    font-size: 1.05rem;
}

.fm-recurring-form-section__heading p {
    color: var(--fm-text-muted);
    font-size: .82rem;
    line-height: 1.5;
}

.fm-recurring-form-section__icon {
    display: inline-grid;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--fm-indigo) 10%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-recurring-form-section__icon svg {
    width: 19px;
    height: 19px;
}

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

.fm-recurring-form-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.fm-recurring-form-grid .fm-field,
.fm-recurring-coordinate-grid .fm-field {
    min-width: 0;
}

.fm-recurring-form-toggle-field {
    align-content: start;
}

.fm-recurring-form-toggle-field .fm-switch-control {
    min-height: 50px;
}

.fm-recurring-coordinate-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: 1rem;
    background: var(--fm-surface-soft);
}

.fm-recurring-form-note {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    color: var(--fm-text-muted);
    font-size: .8rem;
    line-height: 1.5;
}

.fm-recurring-form-note svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    margin-top: .08rem;
    color: var(--fm-indigo);
}

.fm-recurring-form-note--boxed {
    min-height: 50px;
    align-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: .75rem .85rem;
    background: var(--fm-surface-soft);
}

.fm-recurring-form-actions {
    position: sticky;
    bottom: .75rem;
    z-index: 5;
    width: fit-content;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-lg);
    padding: .55rem;
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
    box-shadow: var(--fm-shadow-md);
    backdrop-filter: blur(10px);
}

html[data-theme="dark"] .fm-recurring-rule-card,
html[data-theme="dark"] .fm-recurring-form-actions {
    background: color-mix(in srgb, var(--fm-surface) 96%, transparent);
}

@media (max-width: 980px) {
    .fm-recurring-rule-card {
        grid-template-columns: 1fr;
    }

    .fm-recurring-rule-card__actions {
        justify-content: flex-start;
        padding-left: 3.9rem;
    }

    .fm-recurring-form-grid--three,
    .fm-recurring-coordinate-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .fm-page-header--recurring {
        align-items: stretch;
    }

    .fm-recurring-rule-card__main {
        align-items: flex-start;
    }

    .fm-recurring-rule-card__actions {
        padding-left: 0;
    }

    .fm-recurring-form-grid--three,
    .fm-recurring-form-grid--two,
    .fm-recurring-coordinate-grid {
        grid-template-columns: 1fr;
    }

    .fm-recurring-form-actions {
        position: static;
        width: 100%;
    }

    .fm-recurring-form-actions .fm-button {
        flex: 1 1 auto;
    }
}

/* Module 12 / Step 12.4 recurring detail UI refinement */
.fm-page-header--recurring-detail {
    align-items: flex-start;
    gap: 1rem;
}

.fm-recurring-detail-header-actions {
    justify-content: flex-end;
}

.fm-recurring-detail-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.fm-recurring-detail-stat {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 0;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-lg);
    padding: 1rem;
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
}

.fm-recurring-detail-stat__icon,
.fm-recurring-section-icon,
.fm-recurring-occurrence-row__date-icon,
.fm-recurring-occurrence-action-card__icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
}

.fm-recurring-detail-stat__icon {
    width: 42px;
    height: 42px;
    background: color-mix(in srgb, currentColor 10%, var(--fm-surface));
}

.fm-recurring-detail-stat__icon svg,
.fm-recurring-section-icon svg,
.fm-recurring-occurrence-row__date-icon svg,
.fm-recurring-occurrence-action-card__icon svg {
    width: 18px;
    height: 18px;
}

.fm-recurring-detail-stat > div {
    display: grid;
    gap: .14rem;
    min-width: 0;
}

.fm-recurring-detail-stat span:not(.fm-recurring-detail-stat__icon),
.fm-recurring-detail-stat small {
    color: var(--fm-text-muted);
    font-size: .76rem;
}

.fm-recurring-detail-stat strong {
    overflow: hidden;
    color: var(--fm-text);
    font-size: .94rem;
    text-overflow: ellipsis;
}

.fm-recurring-detail-stat.is-indigo { color: var(--fm-indigo); }
.fm-recurring-detail-stat.is-teal { color: var(--fm-teal); }
.fm-recurring-detail-stat.is-blue { color: var(--fm-info); }
.fm-recurring-detail-stat.is-amber { color: var(--fm-warning); }
.fm-recurring-detail-stat.is-success { color: var(--fm-success); }
.fm-recurring-detail-stat.is-slate { color: var(--fm-text-muted); }

.fm-recurring-detail-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
}

.fm-recurring-detail-controls__copy,
.fm-recurring-upcoming-heading,
.fm-recurring-occurrence-row__summary,
.fm-recurring-occurrence-panel__heading,
.fm-recurring-occurrence-action-card__copy,
.fm-recurring-more summary > span {
    display: flex;
    align-items: center;
}

.fm-recurring-detail-controls__copy {
    gap: .8rem;
    min-width: 0;
}

.fm-recurring-detail-controls__copy > div {
    display: grid;
    gap: .16rem;
}

.fm-recurring-detail-controls__copy h2,
.fm-recurring-detail-controls__copy p,
.fm-recurring-upcoming-heading h2,
.fm-recurring-upcoming-heading p {
    margin: 0;
}

.fm-recurring-detail-controls__copy h2,
.fm-recurring-upcoming-heading h2 {
    color: var(--fm-text);
    font-size: 1rem;
}

.fm-recurring-detail-controls__copy p,
.fm-recurring-upcoming-heading p {
    color: var(--fm-text-muted);
    font-size: .8rem;
    line-height: 1.45;
}

.fm-recurring-section-icon {
    width: 40px;
    height: 40px;
    background: color-mix(in srgb, var(--fm-indigo) 10%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-recurring-detail-controls__actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.fm-recurring-upcoming-card {
    padding: 1rem 1.1rem 1.1rem;
}

.fm-recurring-upcoming-heading {
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--fm-border-color);
    padding-bottom: 1rem;
}

.fm-recurring-occurrence-list {
    display: grid;
    gap: .65rem;
    padding-top: .8rem;
}

.fm-recurring-occurrence-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: .75rem .85rem;
    background: var(--fm-surface-soft);
}

.fm-recurring-occurrence-row__summary {
    gap: .7rem;
    min-width: 0;
}

.fm-recurring-occurrence-row__date-icon {
    width: 36px;
    height: 36px;
    background: color-mix(in srgb, var(--fm-indigo) 9%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-recurring-occurrence-row__date {
    display: grid;
    gap: .08rem;
    min-width: 0;
}

.fm-recurring-occurrence-row__date strong {
    color: var(--fm-text);
    font-size: .9rem;
}

.fm-recurring-occurrence-row__date span {
    color: var(--fm-text-muted);
    font-size: .74rem;
}

.fm-recurring-occurrence-row__summary .fm-status-pill {
    margin-left: auto;
}

.fm-recurring-occurrence-row__manage {
    position: relative;
}

.fm-recurring-occurrence-row__manage > summary,
.fm-recurring-more > summary {
    cursor: pointer;
    list-style: none;
}

.fm-recurring-occurrence-row__manage > summary::-webkit-details-marker,
.fm-recurring-more > summary::-webkit-details-marker {
    display: none;
}

.fm-recurring-occurrence-row__manage[open] {
    grid-column: 1 / -1;
}

.fm-recurring-occurrence-row__manage[open] > summary {
    width: fit-content;
    margin-left: auto;
}

.fm-recurring-occurrence-panel {
    display: grid;
    gap: .85rem;
    margin-top: .75rem;
    border-top: 1px solid var(--fm-border-color);
    padding-top: .85rem;
}

.fm-recurring-occurrence-panel__heading {
    justify-content: space-between;
    gap: .75rem;
}

.fm-recurring-occurrence-panel__heading > div {
    display: grid;
    gap: .12rem;
}

.fm-recurring-occurrence-panel__heading strong {
    color: var(--fm-text);
    font-size: .86rem;
}

.fm-recurring-occurrence-panel__heading span {
    color: var(--fm-text-muted);
    font-size: .76rem;
}

.fm-recurring-occurrence-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
}

.fm-recurring-occurrence-action-card {
    display: grid;
    gap: .65rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: .8rem;
    background: var(--fm-surface);
}

.fm-recurring-occurrence-action-card--wide {
    grid-column: 1 / -1;
}

.fm-recurring-occurrence-action-card__copy {
    gap: .65rem;
}

.fm-recurring-occurrence-action-card__copy > div {
    display: grid;
    gap: .08rem;
}

.fm-recurring-occurrence-action-card__copy strong {
    color: var(--fm-text);
    font-size: .82rem;
}

.fm-recurring-occurrence-action-card__copy span {
    color: var(--fm-text-muted);
    font-size: .73rem;
}

.fm-recurring-occurrence-action-card__icon {
    width: 34px;
    height: 34px;
    background: color-mix(in srgb, var(--fm-indigo) 8%, var(--fm-surface-soft));
    color: var(--fm-indigo);
}

.fm-recurring-occurrence-action-card__fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .55rem;
}

.fm-recurring-occurrence-override-grid {
    display: grid;
    grid-template-columns: minmax(120px, .7fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
    gap: .55rem;
}

.fm-recurring-more {
    margin-top: .8rem;
    border-top: 1px solid var(--fm-border-color);
    padding-top: .8rem;
}

.fm-recurring-more > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
    border: 1px dashed var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    padding: .72rem .85rem;
    color: var(--fm-indigo);
    background: color-mix(in srgb, var(--fm-indigo) 4%, var(--fm-surface));
    font-weight: 700;
}

.fm-recurring-more summary > span {
    gap: .45rem;
}

.fm-recurring-more summary svg {
    width: 17px;
    height: 17px;
}

.fm-recurring-more summary small {
    color: var(--fm-text-muted);
    font-size: .72rem;
    font-weight: 500;
}

.fm-recurring-more[open] > summary {
    margin-bottom: .1rem;
}

.fm-empty-state--compact {
    min-height: 180px;
}

html[data-theme="dark"] .fm-recurring-detail-stat,
html[data-theme="dark"] .fm-recurring-occurrence-action-card,
html[data-theme="dark"] .fm-recurring-occurrence-row {
    background: color-mix(in srgb, var(--fm-surface) 96%, transparent);
}

@media (max-width: 1180px) {
    .fm-recurring-detail-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .fm-recurring-occurrence-override-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .fm-recurring-detail-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fm-recurring-detail-controls,
    .fm-recurring-upcoming-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .fm-recurring-occurrence-actions {
        grid-template-columns: 1fr;
    }

    .fm-recurring-occurrence-action-card--wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .fm-recurring-detail-summary {
        grid-template-columns: 1fr;
    }

    .fm-recurring-detail-header-actions,
    .fm-recurring-detail-controls__actions {
        width: 100%;
    }

    .fm-recurring-detail-header-actions .fm-button,
    .fm-recurring-detail-controls__actions .fm-button,
    .fm-recurring-detail-controls__actions form {
        flex: 1 1 auto;
    }

    .fm-recurring-detail-controls__actions form .fm-button {
        width: 100%;
    }

    .fm-recurring-occurrence-row {
        grid-template-columns: 1fr;
    }

    .fm-recurring-occurrence-row__manage > summary,
    .fm-recurring-occurrence-row__manage[open] > summary {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .fm-recurring-occurrence-action-card__fields,
    .fm-recurring-occurrence-override-grid {
        grid-template-columns: 1fr;
    }

    .fm-recurring-more > summary {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* Module 13.1 — calendar read model carry-forward select alignment */
.fm-select-input--no-leading-icon.ts-wrapper.single .ts-control {
    padding-left: 14px;
}

/* Module 13 / Step 13.2 — Expense calendar */
.fm-calendar-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}.fm-calendar-summary-card{display:flex;align-items:center;gap:.9rem;min-height:92px;padding:1rem 1.1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:18px;background:var(--fm-surface,#fff);box-shadow:0 8px 24px rgba(15,23,42,.04)}.fm-calendar-summary-card__icon{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:color-mix(in srgb,currentColor 12%,transparent);flex:0 0 auto}.fm-calendar-summary-card__icon svg{width:20px;height:20px}.fm-calendar-summary-card>div{display:grid;gap:.2rem;min-width:0}.fm-calendar-summary-card small{color:var(--fm-text-muted,#64748b);font-size:.75rem;font-weight:700}.fm-calendar-summary-card strong{color:var(--fm-text,#111827);font-size:1.25rem;line-height:1.15;overflow:hidden;text-overflow:ellipsis}.fm-calendar-summary-card.is-indigo{color:var(--fm-indigo,#4f46e5)}.fm-calendar-summary-card.is-teal{color:var(--fm-teal,#0f766e)}.fm-calendar-summary-card.is-amber{color:var(--fm-warning,#b45309)}.fm-calendar-summary-card.is-slate{color:var(--fm-text-muted,#64748b)}
.fm-calendar-shell{padding:0;overflow:hidden}.fm-calendar-toolbar{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:1rem;padding:1.15rem 1.25rem;border-bottom:1px solid var(--fm-border,#e2e8f0)}.fm-calendar-toolbar>div{text-align:center}.fm-calendar-toolbar h2{margin:.12rem 0 0;font-size:1.25rem}.fm-calendar-legend{display:flex;align-items:center;justify-content:center;gap:1rem;flex-wrap:wrap;padding:.7rem 1rem;background:var(--fm-surface-muted,#f8fafc);border-bottom:1px solid var(--fm-border,#e2e8f0);font-size:.76rem;color:var(--fm-text-muted,#64748b);font-weight:700}.fm-calendar-legend span{display:inline-flex;align-items:center;gap:.38rem}.fm-calendar-legend i{width:8px;height:8px;border-radius:999px;background:currentColor}.fm-calendar-legend .is-recorded{color:var(--fm-success,#15803d)}.fm-calendar-legend .is-projected{color:var(--fm-indigo,#4f46e5)}.fm-calendar-legend .is-skipped{color:var(--fm-warning,#b45309)}
.fm-calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));background:var(--fm-border,#e2e8f0);gap:1px}.fm-calendar-weekday{padding:.65rem .5rem;text-align:center;background:var(--fm-surface,#fff);color:var(--fm-text-muted,#64748b);font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.fm-calendar-day{min-height:132px;padding:.55rem;background:var(--fm-surface,#fff);overflow:hidden}.fm-calendar-day.is-outside{background:var(--fm-surface-muted,#f8fafc);opacity:.58}.fm-calendar-day.is-today{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--fm-indigo,#4f46e5) 50%,transparent)}.fm-calendar-day__head{display:flex;align-items:center;justify-content:space-between;gap:.4rem;margin-bottom:.45rem}.fm-calendar-day__head>span{display:grid;place-items:center;width:28px;height:28px;border-radius:9px;font-weight:800;font-size:.82rem}.fm-calendar-day.is-today .fm-calendar-day__head>span{background:var(--fm-indigo,#4f46e5);color:#fff}.fm-calendar-day__head small{font-size:.62rem;color:var(--fm-indigo,#4f46e5);font-weight:800}.fm-calendar-day__entries{display:grid;gap:.35rem}.fm-calendar-entry{display:grid;grid-template-columns:auto minmax(0,1fr);gap:.25rem .35rem;align-items:center;padding:.42rem .48rem;border-radius:9px;text-decoration:none;border:1px solid transparent;font-size:.68rem;line-height:1.2;min-width:0}.fm-calendar-entry svg{width:12px;height:12px;grid-row:1/span 2}.fm-calendar-entry span,.fm-calendar-entry strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fm-calendar-entry strong{font-size:.63rem}.fm-calendar-entry.is-recorded{background:color-mix(in srgb,var(--fm-success,#15803d) 9%,transparent);color:var(--fm-success,#15803d);border-color:color-mix(in srgb,var(--fm-success,#15803d) 18%,transparent)}.fm-calendar-entry.is-projected{background:color-mix(in srgb,var(--fm-indigo,#4f46e5) 9%,transparent);color:var(--fm-indigo,#4f46e5);border-color:color-mix(in srgb,var(--fm-indigo,#4f46e5) 18%,transparent)}.fm-calendar-entry.is-skipped{background:color-mix(in srgb,var(--fm-warning,#b45309) 9%,transparent);color:var(--fm-warning,#b45309);border-color:color-mix(in srgb,var(--fm-warning,#b45309) 20%,transparent);text-decoration:line-through}
.fm-calendar-upcoming-card .fm-card-heading{margin-bottom:.75rem}.fm-calendar-upcoming-list{display:grid;gap:.55rem}.fm-calendar-upcoming-row{display:grid;grid-template-columns:52px auto minmax(0,1fr) auto auto;align-items:center;gap:.75rem;padding:.72rem .8rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:13px;text-decoration:none;color:inherit;background:var(--fm-surface,#fff);transition:border-color .15s ease,transform .15s ease}.fm-calendar-upcoming-row:hover{border-color:color-mix(in srgb,var(--fm-indigo,#4f46e5) 40%,var(--fm-border,#e2e8f0));transform:translateY(-1px)}.fm-calendar-upcoming-row__date{font-weight:800;color:var(--fm-text,#111827);font-size:.8rem}.fm-calendar-upcoming-row__icon{display:grid;place-items:center;width:32px;height:32px;border-radius:10px}.fm-calendar-upcoming-row__icon svg{width:16px;height:16px}.fm-calendar-upcoming-row__icon.is-recorded{color:var(--fm-success,#15803d);background:color-mix(in srgb,var(--fm-success,#15803d) 10%,transparent)}.fm-calendar-upcoming-row__icon.is-projected{color:var(--fm-indigo,#4f46e5);background:color-mix(in srgb,var(--fm-indigo,#4f46e5) 10%,transparent)}.fm-calendar-upcoming-row__copy{display:grid;gap:.15rem;min-width:0}.fm-calendar-upcoming-row__copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fm-calendar-upcoming-row__copy small{color:var(--fm-text-muted,#64748b)}.fm-calendar-upcoming-row__amount{white-space:nowrap}.fm-calendar-upcoming-row>svg{width:16px;height:16px;color:var(--fm-text-muted,#64748b)}.fm-calendar-upcoming-empty{padding:1.5rem}
html[data-theme="dark"] .fm-calendar-summary-card,html[data-theme="dark"] .fm-calendar-weekday,html[data-theme="dark"] .fm-calendar-day,html[data-theme="dark"] .fm-calendar-upcoming-row{background:var(--fm-surface,#111827)}html[data-theme="dark"] .fm-calendar-day.is-outside,html[data-theme="dark"] .fm-calendar-legend{background:color-mix(in srgb,var(--fm-surface,#111827) 78%,#000)}
@media(max-width:1050px){.fm-calendar-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.fm-calendar-day{min-height:112px}.fm-calendar-entry strong{display:none}}
@media(max-width:760px){.fm-calendar-summary-grid{grid-template-columns:1fr 1fr}.fm-calendar-page-heading .fm-form-actions{width:100%}.fm-calendar-page-heading .fm-form-actions .fm-button{flex:1}.fm-calendar-shell{overflow-x:auto}.fm-calendar-grid{min-width:760px}.fm-calendar-toolbar,.fm-calendar-legend{min-width:760px}.fm-calendar-upcoming-row{grid-template-columns:44px auto minmax(0,1fr) auto}.fm-calendar-upcoming-row__amount{grid-column:3}.fm-calendar-upcoming-row>svg{grid-column:4;grid-row:1/span 2}.fm-calendar-upcoming-row__icon{grid-row:1/span 2}}
@media(max-width:520px){.fm-calendar-summary-grid{grid-template-columns:1fr}.fm-calendar-upcoming-row{gap:.55rem}.fm-calendar-upcoming-row__amount{font-size:.78rem}}

/* Module 14.4 — Financial goals */
.fm-page-header--goals{align-items:flex-end}.fm-goal-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}.fm-goal-card{display:grid;gap:1.15rem;min-width:0}.fm-goal-card.is-archived{opacity:.72}.fm-goal-card-head{display:flex;align-items:flex-start;gap:.8rem}.fm-goal-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5);flex:none}.fm-goal-icon svg{width:20px;height:20px}.fm-goal-card h2{margin:0 0 .35rem;font-size:1.05rem}.fm-goal-card h2 a{color:inherit;text-decoration:none}.fm-goal-money{display:grid;gap:.15rem}.fm-goal-money strong{font-size:1.45rem;line-height:1.1}.fm-goal-money span,.fm-goal-card-foot,.fm-goal-meta,.fm-contribution-main span,.fm-contribution-main small{color:var(--fm-text-muted,#64748b);font-size:.8rem}.fm-goal-progress{height:9px;overflow:hidden;border-radius:999px;background:var(--fm-border,#e2e8f0)}.fm-goal-progress>span{display:block;height:100%;border-radius:inherit;background:var(--fm-primary,#4f46e5)}.fm-goal-progress--large{height:13px}.fm-goal-card-foot{display:flex;justify-content:space-between;gap:.75rem}.fm-segmented-links{display:inline-flex;gap:.3rem;margin:0 0 1rem;padding:.28rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:12px;background:var(--fm-surface,#fff)}.fm-segmented-links a{padding:.48rem .8rem;border-radius:9px;color:var(--fm-text-muted,#64748b);text-decoration:none;font-weight:700;font-size:.82rem}.fm-segmented-links a.is-active{background:var(--fm-lavender,#eef2ff);color:var(--fm-primary-deep,#4338ca)}.fm-goal-form-card{max-width:980px}.fm-goal-form-grid,.fm-goal-contribution-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.fm-field--wide{grid-column:1/-1}.fm-toggle-row{padding:.8rem 0}.fm-toggle-control{display:flex;align-items:flex-start;gap:.75rem;cursor:pointer}.fm-toggle-control>input{position:absolute;opacity:0;pointer-events:none}.fm-toggle-track{width:44px;height:24px;border-radius:999px;background:var(--fm-border,#cbd5e1);padding:3px;flex:none;transition:.2s}.fm-toggle-track>span{display:block;width:18px;height:18px;border-radius:50%;background:#fff;transition:.2s}.fm-toggle-control>input:checked+.fm-toggle-track{background:var(--fm-primary,#4f46e5)}.fm-toggle-control>input:checked+.fm-toggle-track>span{transform:translateX(20px)}.fm-toggle-control strong,.fm-toggle-control small{display:block}.fm-toggle-control small{margin-top:.2rem;color:var(--fm-text-muted,#64748b)}.fm-goal-metrics{margin-bottom:1rem}.fm-goal-progress-card{display:grid;gap:1rem}.fm-goal-meta{display:flex;gap:1.2rem;flex-wrap:wrap}.fm-goal-meta span{display:inline-flex;align-items:center;gap:.35rem}.fm-goal-meta svg{width:15px;height:15px}.fm-contribution-list{display:grid;gap:.7rem}.fm-contribution-row{display:flex;justify-content:space-between;gap:1rem;padding:.9rem 0;border-bottom:1px solid var(--fm-border,#e2e8f0)}.fm-contribution-row:last-child{border-bottom:0}.fm-contribution-row.is-deleted{opacity:.55}.fm-contribution-main{display:grid;gap:.2rem}.fm-contribution-actions{display:flex;align-items:flex-start;gap:.45rem;flex-wrap:wrap}.fm-correction-form{position:absolute;z-index:10;margin-top:.45rem;width:min(320px,calc(100vw - 3rem));padding:1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:14px;background:var(--fm-surface,#fff);box-shadow:0 16px 40px rgba(15,23,42,.14)}.fm-correction-form .input{margin-bottom:.65rem}.fm-goal-lifecycle{display:flex;align-items:center;justify-content:space-between;gap:1rem}.fm-goal-empty{grid-column:1/-1}.fm-back-link{display:inline-flex;align-items:center;gap:.35rem;margin-bottom:.55rem;color:var(--fm-text-muted,#64748b);text-decoration:none;font-weight:700}.fm-back-link svg{width:16px;height:16px}.fm-select-shell--no-icon>.ts-wrapper,.fm-select-shell--no-icon>.fm-select-input{padding-left:0}
@media(max-width:1100px){.fm-goal-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){.fm-goal-grid,.fm-goal-form-grid,.fm-goal-contribution-grid{grid-template-columns:1fr}.fm-field--wide{grid-column:auto}.fm-contribution-row,.fm-goal-lifecycle{align-items:stretch;flex-direction:column}.fm-contribution-actions{width:100%}.fm-goal-card-foot{align-items:flex-start;flex-direction:column}.fm-page-header--goals .fm-page-actions{width:100%;flex-wrap:wrap}}

/* Module 14.4 acceptance corrective — goals list/form polish */
.fm-page-header--goal-form{margin-bottom:1rem}.fm-goal-form-card--polished{max-width:980px;padding:0;overflow:hidden}.fm-goal-form-card--polished form{display:grid}.fm-goal-form-section{padding:1.4rem 1.5rem}.fm-goal-form-section+.fm-goal-form-section{border-top:1px solid var(--fm-border,#e2e8f0)}.fm-goal-form-section__heading{display:flex;align-items:center;gap:.85rem;margin-bottom:1.1rem}.fm-goal-form-section__heading--compact{margin-bottom:1rem}.fm-goal-form-section__heading h2{margin:0;font-size:1rem}.fm-goal-form-section__icon{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5);flex:none}.fm-goal-form-section__icon svg{width:18px;height:18px}.fm-goal-form-section--automation{padding-top:1rem;padding-bottom:1rem;background:color-mix(in srgb,var(--fm-lavender,#eef2ff) 28%,transparent)}.fm-goal-form-section--automation .fm-toggle-row{padding:0}.fm-goal-form-actions{margin:0;padding:1rem 1.5rem;border-top:1px solid var(--fm-border,#e2e8f0);background:var(--fm-surface-muted,#f8fafc);justify-content:flex-end}.fm-goal-form-card--polished .fm-goal-form-grid{gap:1rem 1.1rem}.fm-goal-form-card--polished .fm-input-shell,.fm-goal-form-card--polished .fm-select-shell{width:100%}.fm-goal-form-card--polished .fm-input,.fm-goal-form-card--polished .ts-control{min-height:50px}.fm-goal-form-card--polished .fm-input-shell>.flatpickr-input+.fm-input{padding-left:46px}.fm-goal-form-card--polished .fm-input-shell>svg{z-index:2}.fm-goals-toolbar{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:0 0 1rem;padding:.45rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:14px;background:var(--fm-surface,#fff);box-shadow:0 8px 24px rgba(15,23,42,.035)}.fm-segmented-links--goals{margin:0;border:0;background:transparent}.fm-goals-toolbar__actions{display:flex;align-items:center;gap:.55rem}.fm-goals-export-button{background:var(--fm-surface,#fff)}.fm-goals-export-button svg{width:17px;height:17px}.fm-goal-card{position:relative;border-color:color-mix(in srgb,var(--fm-border,#e2e8f0) 90%,transparent);transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease}.fm-goal-card:hover{transform:translateY(-2px);border-color:color-mix(in srgb,var(--fm-primary,#4f46e5) 25%,var(--fm-border,#e2e8f0));box-shadow:0 14px 34px rgba(15,23,42,.07)}.fm-goal-card-title{min-width:0;flex:1}.fm-goal-card-title h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fm-goal-card-open{display:grid;place-items:center;width:34px;height:34px;margin-left:auto;border:1px solid var(--fm-border,#e2e8f0);border-radius:10px;color:var(--fm-text-muted,#64748b);text-decoration:none}.fm-goal-card-open:hover{color:var(--fm-primary,#4f46e5);border-color:color-mix(in srgb,var(--fm-primary,#4f46e5) 35%,var(--fm-border,#e2e8f0));background:var(--fm-lavender,#eef2ff)}.fm-goal-card-open svg{width:16px;height:16px}.fm-goal-card-foot strong{color:var(--fm-text,#111827)}.fm-goal-empty{min-height:250px;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center;padding:2.25rem}.fm-goal-empty__icon{display:grid;place-items:center;width:54px;height:54px;margin-bottom:.4rem;border-radius:16px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5)}.fm-goal-empty__icon svg{width:24px;height:24px}.fm-goal-empty p{max-width:540px;margin:.25rem auto 1rem}.fm-goal-empty .fm-button{margin-top:.25rem}html[data-theme="dark"] .fm-goal-form-section--automation,html[data-theme="dark"] .fm-goal-form-actions{background:color-mix(in srgb,var(--fm-surface,#111827) 88%,#000)}html[data-theme="dark"] .fm-goals-toolbar{box-shadow:none}
@media(max-width:720px){.fm-goal-form-section{padding:1.1rem}.fm-goal-form-actions{padding:1rem 1.1rem;flex-direction:column-reverse;align-items:stretch}.fm-goal-form-actions .fm-button{width:100%;justify-content:center}.fm-goals-toolbar{align-items:stretch;flex-direction:column;padding:.55rem}.fm-segmented-links--goals{width:100%;display:grid;grid-template-columns:1fr 1fr}.fm-segmented-links--goals a{text-align:center}.fm-goals-toolbar__actions{display:grid;grid-template-columns:1fr 1fr}.fm-goals-toolbar__actions .fm-button{justify-content:center}.fm-goal-card:hover{transform:none}}
@media(max-width:460px){.fm-goals-toolbar__actions{grid-template-columns:1fr}.fm-goal-form-section__heading{align-items:flex-start}.fm-goal-empty{min-height:220px;padding:1.5rem}}
.fm-goal-form-card--polished [data-goal-allocation-field][hidden]{display:none!important}.fm-goal-form-card--polished .fm-field-error{display:block;margin-top:.38rem;color:var(--fm-danger,#dc2626);font-size:.78rem;font-weight:650}.fm-goal-form-card--polished .fm-field-help{display:block;margin-top:.38rem;color:var(--fm-text-muted,#64748b);font-size:.76rem}.fm-goal-form-card--polished .input.error .fm-input,.fm-goal-form-card--polished .input.error input,.fm-goal-form-card--polished .input.error select{border-color:color-mix(in srgb,var(--fm-danger,#dc2626) 68%,var(--fm-border,#e2e8f0))}

/* Module 14.4 final goals UI acceptance corrective */
.fm-page-header--goal-detail > div:first-child {
    display: grid;
    justify-items: start;
    gap: 0.42rem;
}

.fm-page-header--goal-detail .fm-back-link {
    margin-bottom: 0.15rem;
}

.fm-page-header--goal-detail .fm-eyebrow {
    display: block;
}

.fm-goal-detail-stack {
    display: grid;
    gap: 1.25rem;
}

.fm-goal-detail-stack .fm-goal-metrics {
    margin-bottom: 0;
}

.fm-select-shell--no-icon .fm-select-input.ts-wrapper.single .ts-control {
    padding-left: 14px;
}

@media (max-width: 720px) {
    .fm-goal-detail-stack {
        gap: 1rem;
    }
}

/* Module 15.2 — Dashboard web integration */
.fm-dashboard-shell {
    display: grid;
    gap: 20px;
}

.fm-dashboard-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 18%, var(--fm-border-color));
    border-radius: var(--fm-radius-xl);
    padding: 28px 30px;
    background:
        radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--fm-teal) 14%, transparent), transparent 30%),
        radial-gradient(circle at 8% 110%, color-mix(in srgb, var(--fm-indigo) 18%, transparent), transparent 36%),
        linear-gradient(135deg, color-mix(in srgb, var(--fm-surface) 92%, var(--fm-lavender)), var(--fm-surface));
    box-shadow: var(--fm-shadow-sm);
}

.fm-dashboard-hero::after {
    position: absolute;
    z-index: -1;
    top: -82px;
    right: 15%;
    width: 210px;
    height: 210px;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 10%, transparent);
    border-radius: 50%;
    content: "";
}

.fm-dashboard-hero-copy {
    max-width: 690px;
}

.fm-dashboard-hero-copy h1 {
    margin: 7px 0 8px;
    font-size: clamp(2rem, 4vw, 2.85rem);
    letter-spacing: -0.045em;
}

.fm-dashboard-hero-copy p {
    max-width: 620px;
    margin: 0;
    color: var(--fm-text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

.fm-dashboard-month-nav {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 12%, var(--fm-border-color));
    border-radius: 18px;
    padding: 8px;
    background: color-mix(in srgb, var(--fm-surface) 92%, transparent);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(10px);
}

.fm-dashboard-month-nav .fm-icon-button {
    width: 38px;
    height: 38px;
    box-shadow: none;
}

.fm-dashboard-month-copy {
    display: grid;
    min-width: 166px;
    gap: 2px;
    text-align: center;
}

.fm-dashboard-month-copy span {
    color: var(--fm-text-muted);
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.04em;
}

.fm-dashboard-month-copy strong {
    font-size: 0.97rem;
}

.fm-dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.fm-dashboard-kpi {
    position: relative;
    overflow: hidden;
    display: grid;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    border: 1px solid var(--fm-border-color);
    border-radius: 20px;
    padding: 20px;
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
    transition:
        transform var(--fm-transition),
        box-shadow var(--fm-transition),
        border-color var(--fm-transition);
}

.fm-dashboard-kpi:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--fm-indigo) 22%, var(--fm-border-color));
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.08);
}

.fm-dashboard-kpi-accent {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--fm-indigo);
    opacity: 0.86;
}

.fm-dashboard-kpi--spent .fm-dashboard-kpi-accent {
    background: var(--fm-coral);
}

.fm-dashboard-kpi--remaining .fm-dashboard-kpi-accent {
    background: var(--fm-teal);
}

.fm-dashboard-kpi--today .fm-dashboard-kpi-accent {
    background: linear-gradient(90deg, var(--fm-indigo), var(--fm-teal));
}

.fm-dashboard-kpi .fm-metric-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
}

.fm-dashboard-kpi-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.fm-dashboard-kpi-copy > span {
    color: var(--fm-text-muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.fm-dashboard-kpi-copy > strong {
    overflow: hidden;
    color: var(--fm-text);
    font-size: clamp(1.25rem, 2vw, 1.58rem);
    letter-spacing: -0.035em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-dashboard-kpi-copy small {
    color: var(--fm-text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.fm-dashboard-trend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.fm-dashboard-trend svg {
    width: 14px;
    height: 14px;
}

.fm-dashboard-trend.is-up,
.fm-dashboard-trend-badge.is-up {
    color: var(--fm-danger);
}

.fm-dashboard-trend.is-down,
.fm-dashboard-trend-badge.is-down {
    color: var(--fm-success);
}

.fm-dashboard-trend.is-flat,
.fm-dashboard-trend-badge.is-flat {
    color: var(--fm-text-muted);
}

.fm-dashboard-currency-note {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--fm-info) 24%, var(--fm-border-color));
    border-radius: 14px;
    padding: 11px 14px;
    background: color-mix(in srgb, var(--fm-info) 6%, var(--fm-surface));
    color: var(--fm-text-muted);
    font-size: 0.82rem;
}

.fm-dashboard-currency-note svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--fm-info);
}

.fm-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.68fr) minmax(300px, 0.72fr);
    align-items: start;
    gap: 20px;
}

.fm-dashboard-main-column,
.fm-dashboard-side-column {
    display: grid;
    gap: 20px;
}

.fm-dashboard-panel,
.fm-dashboard-panel--featured {
    position: relative;
    overflow: hidden;
}

.fm-dashboard-panel {
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.fm-dashboard-panel-heading {
    margin-bottom: 20px;
}

.fm-dashboard-panel-heading h2 {
    margin-top: 6px;
    font-size: 1.08rem;
    letter-spacing: -0.025em;
}

.fm-dashboard-section-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--fm-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    transition: color var(--fm-transition), transform var(--fm-transition);
}

.fm-dashboard-section-link:hover {
    transform: translateX(2px);
    color: var(--fm-indigo);
}

.fm-dashboard-section-link svg {
    width: 16px;
    height: 16px;
}

.fm-dashboard-budget-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    border-color: color-mix(in srgb, var(--fm-indigo) 18%, var(--fm-border-color));
    background:
        radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--fm-indigo) 12%, transparent), transparent 42%),
        var(--fm-surface);
}

.fm-dashboard-budget-main {
    min-width: 0;
}

.fm-dashboard-progress {
    overflow: hidden;
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fm-border-color) 68%, var(--fm-surface-soft));
}

.fm-dashboard-progress--large {
    height: 11px;
}

.fm-dashboard-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--fm-indigo), color-mix(in srgb, var(--fm-indigo) 52%, var(--fm-teal)));
    box-shadow: 0 0 18px color-mix(in srgb, var(--fm-indigo) 22%, transparent);
}

.fm-dashboard-budget-meta {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 16px;
}

.fm-dashboard-budget-meta span {
    display: grid;
    gap: 2px;
    color: var(--fm-text-muted);
    font-size: 0.76rem;
}

.fm-dashboard-budget-meta span:last-child {
    text-align: right;
}

.fm-dashboard-budget-meta strong {
    color: var(--fm-text);
    font-size: 1rem;
}

.fm-dashboard-budget-gauge {
    display: grid;
    width: 126px;
    height: 126px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--fm-surface) 58%, transparent 59%),
        conic-gradient(
            from -90deg,
            var(--fm-indigo) 0 var(--fm-dashboard-progress-value),
            color-mix(in srgb, var(--fm-border-color) 78%, transparent) var(--fm-dashboard-progress-value) 100%
        );
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fm-indigo) 8%, transparent);
}

.fm-dashboard-budget-gauge > div {
    display: grid;
    place-items: center;
    gap: 1px;
}

.fm-dashboard-budget-gauge strong {
    font-size: 1.42rem;
    letter-spacing: -0.04em;
}

.fm-dashboard-budget-gauge span {
    color: var(--fm-text-muted);
    font-size: 0.7rem;
    font-weight: 650;
}

.fm-dashboard-category-list {
    display: grid;
    gap: 5px;
}

.fm-dashboard-category-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    border-radius: 14px;
    padding: 11px 12px;
    transition: background var(--fm-transition);
}

.fm-dashboard-category-row:hover {
    background: var(--fm-surface-soft);
}

.fm-dashboard-category-index {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 10px;
    background: var(--fm-lavender);
    color: var(--fm-indigo);
    font-size: 0.75rem;
    font-weight: 750;
}

.fm-dashboard-category-row:nth-child(3n + 2) .fm-dashboard-category-index {
    background: color-mix(in srgb, var(--fm-teal) 10%, var(--fm-surface));
    color: var(--fm-teal);
}

.fm-dashboard-category-row:nth-child(3n) .fm-dashboard-category-index {
    background: color-mix(in srgb, var(--fm-coral) 10%, var(--fm-surface));
    color: var(--fm-coral);
}

.fm-dashboard-category-copy {
    display: grid;
    gap: 2px;
}

.fm-dashboard-category-copy strong {
    font-size: 0.9rem;
}

.fm-dashboard-category-copy span {
    color: var(--fm-text-muted);
    font-size: 0.76rem;
}

.fm-dashboard-category-percent {
    font-size: 0.84rem;
}

.fm-dashboard-category-row > .fm-dashboard-progress {
    grid-column: 2 / -1;
    height: 6px;
}

.fm-dashboard-upcoming-list,
.fm-dashboard-mini-list,
.fm-dashboard-goal-list {
    display: grid;
}

.fm-dashboard-upcoming-row {
    position: relative;
    display: grid;
    grid-template-columns: 54px 38px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 11px;
    border-top: 1px solid var(--fm-border-color);
    padding: 14px 10px;
    color: var(--fm-text);
    transition: background var(--fm-transition), transform var(--fm-transition);
}

.fm-dashboard-upcoming-row:hover {
    z-index: 1;
    transform: translateX(2px);
    border-radius: 12px;
    background: var(--fm-surface-soft);
}

.fm-dashboard-upcoming-row:first-child {
    border-top: 0;
    padding-top: 10px;
}

.fm-dashboard-upcoming-row:last-child {
    padding-bottom: 10px;
}

.fm-dashboard-upcoming-date {
    display: grid;
    place-items: center;
    border-radius: 10px;
    padding: 6px 5px;
    background: var(--fm-surface-soft);
    color: var(--fm-text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.fm-dashboard-upcoming-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
}

.fm-dashboard-upcoming-icon.is-recorded {
    background: color-mix(in srgb, var(--fm-success) 11%, transparent);
    color: var(--fm-success);
}

.fm-dashboard-upcoming-icon.is-projected {
    background: color-mix(in srgb, var(--fm-indigo) 11%, transparent);
    color: var(--fm-indigo);
}

.fm-dashboard-upcoming-icon svg,
.fm-dashboard-upcoming-row > svg {
    width: 17px;
    height: 17px;
}

.fm-dashboard-upcoming-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.fm-dashboard-upcoming-copy strong,
.fm-dashboard-upcoming-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-dashboard-upcoming-copy small {
    color: var(--fm-text-muted);
    font-size: 0.75rem;
}

.fm-dashboard-upcoming-amount {
    font-size: 0.86rem;
}

.fm-dashboard-trend-badge {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface-soft);
}

.fm-dashboard-trend-badge svg {
    width: 19px;
    height: 19px;
}

.fm-dashboard-trend-card {
    min-height: 220px;
    background:
        linear-gradient(155deg, color-mix(in srgb, var(--fm-surface) 94%, var(--fm-lavender)), var(--fm-surface));
}

.fm-dashboard-comparison {
    display: grid;
    gap: 4px;
}

.fm-dashboard-comparison > strong {
    font-size: 1.75rem;
    letter-spacing: -0.04em;
}

.fm-dashboard-comparison span,
.fm-dashboard-comparison small {
    color: var(--fm-text-muted);
}

.fm-dashboard-comparison small {
    line-height: 1.5;
}

.fm-dashboard-trend-visual {
    display: flex;
    height: 48px;
    align-items: flex-end;
    gap: 6px;
    margin-top: 18px;
    opacity: 0.9;
}

.fm-dashboard-trend-visual span {
    width: 100%;
    min-height: 8px;
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--fm-indigo) 72%, var(--fm-teal)), var(--fm-indigo));
}

.fm-dashboard-trend-visual span:nth-child(1) { height: 34%; }
.fm-dashboard-trend-visual span:nth-child(2) { height: 57%; }
.fm-dashboard-trend-visual span:nth-child(3) { height: 44%; }
.fm-dashboard-trend-visual span:nth-child(4) { height: 82%; }
.fm-dashboard-trend-visual span:nth-child(5) { height: 66%; }

.fm-dashboard-recurring-card,
.fm-dashboard-goals-card {
    min-height: 210px;
}

.fm-dashboard-mini-list > a,
.fm-dashboard-goal-list > a {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--fm-border-color);
    border-radius: 10px;
    padding: 12px 8px;
    color: var(--fm-text);
    transition: background var(--fm-transition), transform var(--fm-transition);
}

.fm-dashboard-mini-list > a:hover,
.fm-dashboard-goal-list > a:hover {
    transform: translateX(2px);
    background: var(--fm-surface-soft);
}

.fm-dashboard-mini-list > a:first-child,
.fm-dashboard-goal-list > a:first-child {
    border-top: 0;
}

.fm-dashboard-mini-list > a {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.fm-dashboard-mini-list span,
.fm-dashboard-goal-list div {
    display: grid;
    gap: 2px;
}

.fm-dashboard-mini-list small,
.fm-dashboard-goal-list span {
    color: var(--fm-text-muted);
    font-size: 0.75rem;
}

.fm-dashboard-goal-list > a {
    grid-template-columns: minmax(0, 1fr) auto;
}

.fm-dashboard-goal-list .fm-dashboard-progress {
    grid-column: 1 / -1;
    height: 5px;
}

/* Shared UI polish primitives introduced with the dashboard design anchor. */
.fm-card.fm-dashboard-panel,
.fm-card.fm-dashboard-panel--featured {
    border-radius: 20px;
}

.fm-dashboard-panel .fm-icon-button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    box-shadow: none;
}

html[data-theme="dark"] .fm-dashboard-hero,
html[data-theme="dark"] .fm-dashboard-budget-card,
html[data-theme="dark"] .fm-dashboard-trend-card {
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .fm-dashboard-month-nav {
    background: color-mix(in srgb, var(--fm-surface) 90%, transparent);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}

@media (max-width: 1100px) {
    .fm-dashboard-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .fm-dashboard-side-column {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .fm-dashboard-hero {
        align-items: stretch;
        flex-direction: column;
        padding: 24px;
    }

    .fm-dashboard-month-nav {
        align-self: stretch;
        justify-content: space-between;
    }

    .fm-dashboard-month-copy {
        flex: 1;
    }

    .fm-dashboard-side-column {
        grid-template-columns: 1fr;
    }

    .fm-dashboard-budget-card {
        grid-template-columns: 1fr;
    }

    .fm-dashboard-budget-gauge {
        width: 112px;
        height: 112px;
        justify-self: start;
    }
}

@media (max-width: 620px) {
    .fm-dashboard-shell {
        gap: 14px;
    }

    .fm-dashboard-hero {
        border-radius: 20px;
        padding: 20px;
    }

    .fm-dashboard-hero-copy h1 {
        font-size: 2rem;
    }

    .fm-dashboard-kpis {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .fm-dashboard-kpi {
        padding: 17px;
    }

    .fm-dashboard-layout,
    .fm-dashboard-main-column,
    .fm-dashboard-side-column {
        gap: 14px;
    }

    .fm-dashboard-budget-meta {
        display: grid;
    }

    .fm-dashboard-budget-meta span:last-child {
        text-align: left;
    }

    .fm-dashboard-category-row {
        grid-template-columns: 30px minmax(0, 1fr) auto;
        padding-inline: 4px;
    }

    .fm-dashboard-upcoming-row {
        grid-template-columns: 48px minmax(0, 1fr) auto;
        padding-inline: 4px;
    }

    .fm-dashboard-upcoming-icon,
    .fm-dashboard-upcoming-row > svg {
        display: none;
    }

    .fm-dashboard-upcoming-copy small {
        white-space: normal;
    }
}

@media (max-width: 420px) {
    .fm-dashboard-month-copy {
        min-width: 0;
    }

    .fm-dashboard-month-copy strong {
        font-size: 0.88rem;
    }

    .fm-dashboard-upcoming-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .fm-dashboard-upcoming-amount {
        grid-column: 2;
        color: var(--fm-text-muted);
        font-size: 0.78rem;
    }
}


/* Module 16.2 dashboard personalization */
.fm-dashboard-hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.fm-dashboard-personalized-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.fm-dashboard-personalized-layout .fm-dashboard-main-column,
.fm-dashboard-personalized-layout .fm-dashboard-side-column {
    display: contents;
}

.fm-dashboard-widget--full {
    grid-column: 1 / -1;
}

.fm-dashboard-personalized-layout > .fm-dashboard-kpis {
    margin: 0;
}

.fm-dashboard-customize-panel {
    width: min(100%, 760px);
}

.fm-dashboard-customize-form {
    display: grid;
    gap: 18px;
}

.fm-dashboard-customize-list {
    display: grid;
    gap: 8px;
}

.fm-dashboard-customize-item {
    display: grid;
    grid-template-columns: 34px 40px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface);
    padding: 11px 12px;
    transition: border-color var(--fm-transition), background var(--fm-transition), opacity var(--fm-transition);
}

.fm-dashboard-customize-item:hover {
    border-color: color-mix(in srgb, var(--fm-indigo) 26%, var(--fm-border-color));
    background: var(--fm-surface-soft);
}

.fm-dashboard-customize-item.is-dragging {
    opacity: 0.45;
}

.fm-dashboard-drag-handle,
.fm-dashboard-order-actions button {
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--fm-text-muted);
}

.fm-dashboard-drag-handle {
    width: 30px;
    height: 34px;
    cursor: grab;
}

.fm-dashboard-drag-handle:active {
    cursor: grabbing;
}

.fm-dashboard-drag-handle svg,
.fm-dashboard-order-actions svg {
    width: 17px;
    height: 17px;
}

.fm-dashboard-customize-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: color-mix(in srgb, var(--fm-indigo) 9%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-dashboard-customize-icon svg {
    width: 18px;
    height: 18px;
}

.fm-dashboard-customize-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.fm-dashboard-customize-copy strong {
    font-size: 0.9rem;
}

.fm-dashboard-customize-copy small {
    color: var(--fm-text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.fm-dashboard-order-actions {
    display: inline-flex;
    gap: 2px;
}

.fm-dashboard-order-actions button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
}

.fm-dashboard-order-actions button:hover {
    background: var(--fm-surface);
    color: var(--fm-indigo);
}

.fm-dashboard-widget-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.fm-dashboard-widget-toggle input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.fm-dashboard-widget-toggle .fm-toggle-track {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fm-text-muted) 22%, var(--fm-surface-soft));
    transition: background var(--fm-transition);
}

.fm-dashboard-widget-toggle .fm-toggle-track > span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgb(15 23 42 / 0.18);
    transition: transform var(--fm-transition);
}

.fm-dashboard-widget-toggle input:checked + .fm-toggle-track {
    background: var(--fm-indigo);
}

.fm-dashboard-widget-toggle input:checked + .fm-toggle-track > span {
    transform: translateX(18px);
}

.fm-dashboard-widget-toggle input:focus-visible + .fm-toggle-track {
    outline: 3px solid color-mix(in srgb, var(--fm-indigo) 20%, transparent);
    outline-offset: 2px;
}

.fm-dashboard-customize-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--fm-border-color);
    padding-top: 18px;
}

@media (max-width: 900px) {
    .fm-dashboard-personalized-layout {
        grid-template-columns: 1fr;
    }

    .fm-dashboard-widget,
    .fm-dashboard-widget--full {
        grid-column: 1;
    }
}

@media (max-width: 680px) {
    .fm-dashboard-hero-actions,
    .fm-dashboard-customize-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .fm-dashboard-hero-actions .fm-button,
    .fm-dashboard-customize-footer > .fm-button {
        width: 100%;
    }

    .fm-dashboard-customize-item {
        grid-template-columns: 28px 36px minmax(0, 1fr) auto;
    }

    .fm-dashboard-order-actions {
        grid-column: 2 / 4;
        justify-self: start;
    }
}


/* Module 17.2 financial intelligence analytics */
.fm-analytics-heading {
    align-items: flex-end;
}

.fm-analytics-asof {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
    padding: 10px 13px;
    color: var(--fm-text-muted);
    font-size: 0.8rem;
}

.fm-analytics-asof svg { width: 16px; height: 16px; color: var(--fm-indigo); }
.fm-analytics-asof strong { color: var(--fm-text); }

.fm-analytics-health {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 28px;
    padding: 28px;
    overflow: hidden;
}

.fm-analytics-score {
    display: grid;
    width: 164px;
    height: 164px;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--fm-indigo) var(--fm-health-score), color-mix(in srgb, var(--fm-indigo) 10%, var(--fm-surface-soft)) 0);
    position: relative;
}

.fm-analytics-score::after {
    content: '';
    position: absolute;
    inset: 13px;
    border-radius: inherit;
    background: var(--fm-surface);
}

.fm-analytics-score > div { position: relative; z-index: 1; display: flex; align-items: baseline; gap: 4px; }
.fm-analytics-score strong { font-size: 2.5rem; line-height: 1; letter-spacing: -0.05em; }
.fm-analytics-score span { color: var(--fm-text-muted); font-size: 0.8rem; font-weight: 700; }
.fm-analytics-health-copy > h2 { margin: 4px 0 7px; font-size: clamp(1.45rem, 2vw, 2rem); }
.fm-analytics-health-copy > p { margin: 0; color: var(--fm-text-muted); }

.fm-analytics-component-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.fm-analytics-component { display: grid; gap: 6px; border: 1px solid var(--fm-border-color); border-radius: 12px; background: var(--fm-surface-soft); padding: 11px; }
.fm-analytics-component > div:first-child { display: flex; justify-content: space-between; gap: 8px; font-size: 0.76rem; }
.fm-analytics-component > div:first-child span { color: var(--fm-text-muted); }
.fm-analytics-component small { color: var(--fm-text-muted); font-size: 0.7rem; }

.fm-analytics-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.fm-analytics-kpi { display: flex; gap: 13px; align-items: center; min-height: 112px; padding: 18px; }
.fm-analytics-kpi-icon { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--fm-indigo) 10%, var(--fm-surface)); color: var(--fm-indigo); }
.fm-analytics-kpi-icon svg { width: 19px; height: 19px; }
.fm-analytics-kpi > div { display: grid; gap: 2px; min-width: 0; }
.fm-analytics-kpi small, .fm-analytics-kpi span { color: var(--fm-text-muted); font-size: 0.73rem; }
.fm-analytics-kpi strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.fm-analytics-kpi span.is-positive { color: var(--fm-success); }
.fm-analytics-kpi span.is-negative { color: var(--fm-danger); }

.fm-analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.fm-analytics-panel { padding: 22px; min-width: 0; }
.fm-analytics-panel--wide { grid-column: 1 / -1; }
.fm-analytics-panel .fm-card-heading { align-items: flex-start; }
.fm-analytics-panel .fm-card-heading p { margin: 4px 0 0; color: var(--fm-text-muted); font-size: 0.8rem; }
.fm-analytics-panel-note { margin: 16px 0 0; color: var(--fm-text-muted); font-size: 0.82rem; }

.fm-status-badge { display: inline-flex; align-items: center; border-radius: 999px; background: var(--fm-surface-soft); padding: 5px 9px; color: var(--fm-text-muted); font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.fm-status-badge.is-healthy, .fm-status-badge.is-balanced, .fm-status-badge.is-low, .fm-status-badge.is-on_track, .fm-status-badge.is-achieved, .fm-status-badge.is-active, .fm-status-badge.is-down { background: color-mix(in srgb, var(--fm-success) 12%, var(--fm-surface)); color: var(--fm-success); }
.fm-status-badge.is-warning, .fm-status-badge.is-elevated, .fm-status-badge.is-moderate, .fm-status-badge.is-mixed, .fm-status-badge.is-quiet { background: color-mix(in srgb, var(--fm-warning) 14%, var(--fm-surface)); color: var(--fm-warning); }
.fm-status-badge.is-critical, .fm-status-badge.is-high, .fm-status-badge.is-over_budget, .fm-status-badge.is-off_track, .fm-status-badge.is-inactive, .fm-status-badge.is-up { background: color-mix(in srgb, var(--fm-danger) 12%, var(--fm-surface)); color: var(--fm-danger); }

.fm-analytics-trend-values { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; margin-top: 22px; }
.fm-analytics-trend-values > div { display: grid; gap: 3px; border: 1px solid var(--fm-border-color); border-radius: 12px; background: var(--fm-surface-soft); padding: 14px; }
.fm-analytics-trend-values small { color: var(--fm-text-muted); }
.fm-analytics-trend-values svg { width: 18px; color: var(--fm-text-muted); }
.fm-analytics-concentration-value { display: flex; align-items: baseline; gap: 10px; margin: 24px 0 12px; }
.fm-analytics-concentration-value strong { font-size: 2rem; letter-spacing: -0.04em; }
.fm-analytics-concentration-value span { color: var(--fm-text-muted); }

.fm-analytics-list { display: grid; margin-top: 8px; }
.fm-analytics-list-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 18px; align-items: center; gap: 12px; border-bottom: 1px solid var(--fm-border-color); padding: 13px 2px; color: inherit; text-decoration: none; }
.fm-analytics-list-row:last-child { border-bottom: 0; }
.fm-analytics-list-row:hover .fm-analytics-list-copy strong { color: var(--fm-indigo); }
.fm-analytics-list-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--fm-warning) 13%, var(--fm-surface)); color: var(--fm-warning); }
.fm-analytics-list-icon svg { width: 17px; height: 17px; }
.fm-analytics-list-copy, .fm-analytics-list-value { display: grid; gap: 2px; }
.fm-analytics-list-copy small, .fm-analytics-list-value small { color: var(--fm-text-muted); font-size: 0.72rem; }
.fm-analytics-list-value { text-align: right; }
.fm-analytics-list-row > svg { width: 16px; color: var(--fm-text-muted); }

.fm-analytics-activity { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.fm-analytics-activity > div { display: grid; gap: 2px; }
.fm-analytics-activity > div strong { font-size: 2rem; line-height: 1; }
.fm-analytics-activity > div span, .fm-analytics-activity > div small { color: var(--fm-text-muted); }
.fm-analytics-activity > div small { font-size: 0.72rem; }

.fm-analytics-goals { display: grid; margin-top: 10px; }
.fm-analytics-goals > a { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--fm-border-color); padding: 12px 0; color: inherit; text-decoration: none; }
.fm-analytics-goals > a:last-child { border-bottom: 0; }
.fm-analytics-goals > a > span:first-child { display: grid; gap: 2px; }
.fm-analytics-goals small { color: var(--fm-text-muted); }

@media (max-width: 1100px) {
    .fm-analytics-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fm-analytics-component-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .fm-analytics-heading { align-items: stretch; }
    .fm-analytics-asof { align-self: flex-start; }
    .fm-analytics-health { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .fm-analytics-component-grid { grid-template-columns: 1fr; text-align: left; }
    .fm-analytics-kpi-grid, .fm-analytics-grid { grid-template-columns: 1fr; }
    .fm-analytics-panel--wide { grid-column: auto; }
}

@media (max-width: 520px) {
    .fm-analytics-kpi-grid { grid-template-columns: 1fr; }
    .fm-analytics-health, .fm-analytics-panel { padding: 18px; }
    .fm-analytics-list-row { grid-template-columns: 36px minmax(0, 1fr) 16px; }
    .fm-analytics-list-value { grid-column: 2; text-align: left; }
    .fm-analytics-trend-values { grid-template-columns: 1fr; }
    .fm-analytics-trend-values > svg { transform: rotate(90deg); justify-self: center; }
}

/* Module 19.2 entitlement allowance feedback */
.fm-inline-notice{display:flex;align-items:center;gap:.65rem;padding:.75rem .9rem;margin-bottom:1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:12px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary-deep,#4338ca);font-size:.86rem;font-weight:700}.fm-inline-notice svg{width:18px;height:18px;flex:0 0 auto}.fm-inline-notice--warning{background:rgba(180,83,9,.08);border-color:rgba(180,83,9,.24);color:var(--fm-warning,#b45309)}html[data-theme="dark"] .fm-inline-notice{background:rgba(79,70,229,.12)}html[data-theme="dark"] .fm-inline-notice--warning{background:rgba(180,83,9,.12)}

/* Module 25.1 — Planned Spending UI refinement */
.fm-page-header--planned{align-items:flex-end}.fm-page-header--planned .fm-button{flex:none}.fm-planned-toolbar{display:grid;grid-template-columns:auto minmax(210px,1fr) auto auto;align-items:center;gap:.65rem;margin-bottom:1rem;padding:.5rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:15px;background:var(--fm-surface,#fff);box-shadow:0 8px 24px rgba(15,23,42,.035)}.fm-planned-toolbar__nav{width:42px;height:42px}.fm-planned-toolbar__current{display:flex;align-items:center;gap:.75rem;min-width:0;padding:.35rem .5rem}.fm-planned-toolbar__current>div{display:grid;gap:.08rem;min-width:0}.fm-planned-toolbar__current small{color:var(--fm-text-muted,#64748b);font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.06em}.fm-planned-toolbar__current strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.96rem}.fm-planned-toolbar__icon{display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5);flex:none}.fm-planned-toolbar__icon svg{width:18px;height:18px}.fm-planned-toolbar__picker{display:flex;align-items:center;gap:.5rem}.fm-planned-toolbar__picker .fm-input{width:168px;min-height:42px}.fm-planned-toolbar__picker .fm-button{min-height:42px}.fm-planned-metrics{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:1rem}.fm-planned-list-card{padding:0;overflow:hidden}.fm-planned-list-card__heading{margin:0;padding:1.25rem 1.4rem;border-bottom:1px solid var(--fm-border,#e2e8f0)}.fm-planned-list-card__heading h2{margin:.25rem 0 0;font-size:1.05rem}.fm-planned-table-wrap{border:0;border-radius:0}.fm-planned-table{margin:0}.fm-planned-table thead th{background:var(--fm-surface-muted,#f8fafc)}.fm-planned-category-cell{display:flex;align-items:center;gap:.65rem;min-width:170px}.fm-planned-category-cell__icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5);flex:none}.fm-planned-category-cell__icon svg{width:15px;height:15px}.fm-planned-amount{font-variant-numeric:tabular-nums;white-space:nowrap}.fm-planned-notes{max-width:320px;color:var(--fm-text-muted,#64748b)}.fm-planned-empty-cell{padding:0!important}.fm-planned-empty{min-height:300px;padding:2.5rem}.fm-planned-empty h3{margin:1rem 0 .35rem;font-size:1.05rem}.fm-planned-empty p{margin:0 auto 1rem}.fm-planned-empty .fm-button{margin-top:.35rem}.fm-badge--soft{max-width:210px;white-space:normal;text-align:center}.fm-icon-button--danger:hover{border-color:color-mix(in srgb,var(--fm-danger,#dc2626) 35%,var(--fm-border,#e2e8f0));background:color-mix(in srgb,var(--fm-danger,#dc2626) 8%,var(--fm-surface,#fff));color:var(--fm-danger,#dc2626)}.fm-muted{color:var(--fm-text-muted,#64748b)}
.fm-page-header--planned-form{margin-bottom:1rem}.fm-planned-form-card{max-width:1040px;padding:0;overflow:hidden}.fm-planned-form-card form{display:grid}.fm-planned-form-section{padding:1.45rem 1.55rem}.fm-planned-form-section+.fm-planned-form-section{border-top:1px solid var(--fm-border,#e2e8f0)}.fm-planned-form-section__heading{display:flex;align-items:flex-start;gap:.85rem;margin-bottom:1.15rem}.fm-planned-form-section__heading--compact{margin-bottom:1rem}.fm-planned-form-section__heading h2{margin:.05rem 0 .2rem;font-size:1.02rem}.fm-planned-form-section__heading p{margin:0;color:var(--fm-text-muted,#64748b);font-size:.82rem}.fm-planned-form-section__copy{min-width:0;flex:1}.fm-planned-form-section__icon{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5);flex:none}.fm-planned-form-section__icon svg{width:19px;height:19px}.fm-planned-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem 1.1rem}.fm-planned-form-grid .fm-input-shell,.fm-planned-form-grid .fm-select-shell{width:100%}.fm-planned-form-grid .fm-input,.fm-planned-form-grid .ts-control{min-height:50px}.fm-planned-notes-input{min-height:118px;resize:vertical}.fm-planned-form-section--advanced{background:color-mix(in srgb,var(--fm-lavender,#eef2ff) 22%,var(--fm-surface,#fff))}.fm-planned-form-section--advanced.is-locked{background:color-mix(in srgb,var(--fm-surface-muted,#f8fafc) 80%,var(--fm-surface,#fff))}.fm-planned-pro-badge{display:inline-flex;align-items:center;gap:.35rem;margin-left:auto;flex:none}.fm-planned-pro-badge svg{width:13px;height:13px}.fm-planned-advanced-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem}.fm-planned-toggle-row{margin:0;padding:1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:13px;background:var(--fm-surface,#fff)}.fm-planned-form-section.is-locked .fm-planned-toggle-row{opacity:.72}.fm-planned-pro-notice{margin:1rem 0 0;background:var(--fm-surface,#fff)}.fm-planned-form-actions{margin:0;padding:1rem 1.55rem;border-top:1px solid var(--fm-border,#e2e8f0);background:var(--fm-surface-muted,#f8fafc);justify-content:flex-end}.fm-planned-form .fm-field-help{display:block;margin-top:.35rem}.fm-planned-form .fm-field-error{display:block;margin-top:.35rem}
html[data-theme="dark"] .fm-planned-toolbar{box-shadow:none}html[data-theme="dark"] .fm-planned-form-section--advanced{background:color-mix(in srgb,var(--fm-surface,#111827) 88%,var(--fm-primary,#4f46e5))}html[data-theme="dark"] .fm-planned-form-section--advanced.is-locked,html[data-theme="dark"] .fm-planned-form-actions,html[data-theme="dark"] .fm-planned-table thead th{background:color-mix(in srgb,var(--fm-surface,#111827) 90%,#000)}
@media(max-width:840px){.fm-planned-toolbar{grid-template-columns:auto minmax(0,1fr) auto}.fm-planned-toolbar__picker{grid-column:1/-1;display:grid;grid-template-columns:1fr auto}.fm-planned-toolbar__picker .fm-input{width:100%}.fm-planned-metrics,.fm-planned-form-grid,.fm-planned-advanced-options{grid-template-columns:1fr}.fm-planned-form-grid .fm-field--wide{grid-column:auto}.fm-page-header--planned .fm-button{width:100%}}
@media(max-width:560px){.fm-planned-toolbar{gap:.4rem}.fm-planned-toolbar__current{padding:.25rem}.fm-planned-toolbar__icon{display:none}.fm-planned-toolbar__picker{grid-template-columns:1fr}.fm-planned-toolbar__picker .fm-button{width:100%}.fm-planned-form-section{padding:1.15rem}.fm-planned-form-actions{display:grid;padding:1rem 1.15rem}.fm-planned-form-actions .fm-button{width:100%}.fm-planned-form-section__heading{gap:.65rem}.fm-planned-pro-badge{margin-left:0}.fm-planned-list-card__heading{padding:1.05rem 1.15rem}}

/* Module 25.1 — Planned Spending UI corrective v2 */
.fm-page-header--planned,
.fm-page-header--planned-form {
    gap: 1.25rem;
}

.fm-page-header--planned-form {
    max-width: 1180px;
}

.fm-planned-toolbar {
    grid-template-columns: auto minmax(220px, 1fr) minmax(300px, auto) auto;
    padding: .7rem;
}

.fm-planned-toolbar__picker {
    min-width: 0;
}

.fm-planned-month-shell {
    width: 210px;
}

.fm-planned-month-shell > svg,
.fm-planned-form .fm-input-shell > svg {
    z-index: 3;
    pointer-events: none;
}

.fm-planned-month-shell .flatpickr-input,
.fm-planned-form .flatpickr-input {
    cursor: pointer;
}

.fm-planned-month-shell > .flatpickr-input + .fm-input,
.fm-planned-form .fm-input-shell > .flatpickr-input + .fm-input {
    padding-left: 46px;
    cursor: pointer;
}

.fm-planned-list-card {
    overflow: visible;
}

.fm-planned-items {
    display: grid;
    gap: .75rem;
    padding: 1rem;
}

.fm-planned-item-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.1fr) minmax(145px, .6fr) minmax(280px, 1.4fr) auto;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--fm-border, #e2e8f0);
    border-radius: 14px;
    background: var(--fm-surface, #fff);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.fm-planned-item-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--fm-primary, #4f46e5) 22%, var(--fm-border, #e2e8f0));
    box-shadow: 0 10px 26px rgba(15, 23, 42, .055);
}

.fm-planned-item-card__main {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-width: 0;
}

.fm-planned-item-card__identity,
.fm-planned-item-card__amount,
.fm-planned-item-card__meta > div {
    display: grid;
    gap: .2rem;
    min-width: 0;
}

.fm-planned-item-card__identity strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-planned-item-card__identity span,
.fm-planned-item-card__amount small,
.fm-planned-item-card__meta small {
    color: var(--fm-text-muted, #64748b);
    font-size: .75rem;
}

.fm-planned-item-card__amount strong {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fm-planned-item-card__meta {
    display: grid;
    grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr);
    gap: 1rem;
    min-width: 0;
}

.fm-planned-item-card__notes {
    overflow: hidden;
    color: var(--fm-text-muted, #64748b);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-planned-item-card__actions {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.fm-planned-form-card {
    width: 100%;
    max-width: 1180px;
}

.fm-planned-form-section {
    padding: 1.55rem 1.75rem;
}

.fm-planned-form-grid {
    gap: 1.1rem 1.25rem;
}

.fm-planned-form .fm-field {
    min-width: 0;
}

.fm-planned-form .fm-field > label,
.fm-planned-form .input > label {
    display: block;
    margin-bottom: .42rem;
    font-size: .82rem;
    font-weight: 750;
    color: var(--fm-text, #111827);
}

.fm-planned-form .input {
    margin: 0;
}

.fm-planned-form .fm-input,
.fm-planned-form .ts-control {
    width: 100%;
}

.fm-planned-form-section--advanced {
    padding-top: 1.35rem;
    padding-bottom: 1.35rem;
}

.fm-planned-advanced-options {
    align-items: stretch;
}

.fm-planned-toggle-row {
    min-width: 0;
    overflow: hidden;
}

.fm-planned-toggle-row .fm-toggle-control {
    width: 100%;
    min-width: 0;
}

.fm-planned-toggle-row .fm-toggle-control > span:last-child {
    min-width: 0;
}

.fm-planned-toggle-row small {
    line-height: 1.45;
}

.fm-planned-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -8px 22px rgba(15, 23, 42, .035);
}

html[data-theme="dark"] .fm-planned-item-card:hover,
html[data-theme="dark"] .fm-planned-form-actions {
    box-shadow: none;
}

@media (max-width: 1040px) {
    .fm-planned-item-card {
        grid-template-columns: minmax(220px, 1.1fr) minmax(140px, .6fr) minmax(220px, 1fr) auto;
    }

    .fm-planned-item-card__meta {
        grid-template-columns: 1fr;
        gap: .55rem;
    }
}

@media (max-width: 840px) {
    .fm-planned-toolbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .fm-planned-toolbar__picker {
        grid-column: 1 / -1;
        width: 100%;
    }

    .fm-planned-month-shell {
        width: 100%;
    }

    .fm-planned-item-card {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .fm-planned-item-card__amount,
    .fm-planned-item-card__meta {
        grid-column: 1;
    }

    .fm-planned-item-card__actions {
        grid-column: 2;
        grid-row: 1 / span 3;
        align-self: center;
        flex-direction: column;
    }

    .fm-planned-item-card__meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fm-planned-form-card,
    .fm-page-header--planned-form {
        max-width: none;
    }
}

@media (max-width: 560px) {
    .fm-planned-items {
        padding: .75rem;
    }

    .fm-planned-item-card {
        gap: .75rem;
        padding: .9rem;
    }

    .fm-planned-item-card__meta {
        grid-template-columns: 1fr;
    }

    .fm-planned-form-section {
        padding: 1.15rem;
    }

    .fm-planned-form-actions {
        position: static;
        box-shadow: none;
    }
}

/* Module 25.2 — Planned Spending calendar + analytics integration */
.fm-calendar-summary-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.fm-calendar-summary-card.is-violet{color:var(--fm-primary,#4f46e5)}.fm-calendar-entry.is-planned{background:color-mix(in srgb,var(--fm-primary,#4f46e5) 7%,var(--fm-surface,#fff));color:var(--fm-primary,#4f46e5);border-color:color-mix(in srgb,var(--fm-primary,#4f46e5) 24%,var(--fm-border,#e2e8f0))}.fm-calendar-legend .is-planned i{background:var(--fm-primary,#4f46e5)}.fm-calendar-upcoming-row__icon.is-planned{background:color-mix(in srgb,var(--fm-primary,#4f46e5) 10%,transparent);color:var(--fm-primary,#4f46e5)}
.fm-analytics-planned-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.8rem}.fm-analytics-planned-grid>div{display:grid;gap:.25rem;padding:1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:14px;background:var(--fm-surface-muted,#f8fafc)}.fm-analytics-planned-grid small{color:var(--fm-text-muted,#64748b);font-size:.75rem;font-weight:700}.fm-analytics-planned-grid strong{font-size:1.05rem;overflow-wrap:anywhere}@media(max-width:1100px){.fm-calendar-summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:760px){.fm-calendar-summary-grid,.fm-analytics-planned-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:520px){.fm-calendar-summary-grid,.fm-analytics-planned-grid{grid-template-columns:1fr}}

/* Module 26.2 — Safe to Spend */
.fm-safe-shell{display:grid;gap:1.25rem}.fm-safe-hero{display:flex;align-items:flex-start;justify-content:space-between;gap:1.5rem;padding:1.5rem;border:1px solid color-mix(in srgb,var(--fm-indigo) 18%,var(--fm-border-color));border-radius:22px;background:linear-gradient(135deg,color-mix(in srgb,var(--fm-indigo) 8%,var(--fm-surface)),color-mix(in srgb,var(--fm-teal) 6%,var(--fm-surface)));box-shadow:0 14px 34px rgba(15,23,42,.05)}.fm-safe-hero h1{margin:.25rem 0 .45rem;font-size:clamp(1.7rem,4vw,2.35rem)}.fm-safe-hero p{max-width:760px;margin:0;color:var(--fm-text-muted);line-height:1.65}.fm-safe-headline{display:flex;align-items:center;justify-content:space-between;gap:1.25rem;padding:1.4rem 1.5rem;border:1px solid var(--fm-border-color);border-radius:22px;background:var(--fm-surface);box-shadow:0 12px 30px rgba(15,23,42,.05)}.fm-safe-headline.is-success{border-color:color-mix(in srgb,var(--fm-success) 30%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-success) 7%,var(--fm-surface)),var(--fm-surface))}.fm-safe-headline.is-warning{border-color:color-mix(in srgb,var(--fm-warning) 30%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-warning) 7%,var(--fm-surface)),var(--fm-surface))}.fm-safe-headline.is-danger{border-color:color-mix(in srgb,var(--fm-danger) 30%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-danger) 7%,var(--fm-surface)),var(--fm-surface))}.fm-safe-headline-main{display:grid;gap:.25rem}.fm-safe-headline-main>strong{font-size:clamp(2.15rem,6vw,3.6rem);line-height:1;color:var(--fm-text)}.fm-safe-headline-main p{margin:.35rem 0 0;color:var(--fm-text-muted)}.fm-safe-status-pill{display:inline-flex;align-items:center;gap:.5rem;padding:.65rem .9rem;border-radius:999px;font-weight:800;white-space:nowrap}.fm-safe-status-pill svg{width:18px;height:18px}.fm-safe-status-pill.is-success{color:var(--fm-success);background:color-mix(in srgb,var(--fm-success) 10%,transparent)}.fm-safe-status-pill.is-warning{color:var(--fm-warning);background:color-mix(in srgb,var(--fm-warning) 10%,transparent)}.fm-safe-status-pill.is-danger{color:var(--fm-danger);background:color-mix(in srgb,var(--fm-danger) 10%,transparent)}.fm-safe-status-pill.is-neutral{color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 10%,transparent)}.fm-safe-alert{display:flex;align-items:flex-start;gap:.8rem;padding:1rem 1.1rem;border-radius:16px;border:1px solid var(--fm-border-color);background:var(--fm-surface)}.fm-safe-alert>svg{width:20px;height:20px;flex:0 0 auto;margin-top:.1rem}.fm-safe-alert>div{display:grid;gap:.2rem}.fm-safe-alert span{color:var(--fm-text-muted);font-size:.86rem}.fm-safe-alert.is-danger{border-color:color-mix(in srgb,var(--fm-danger) 30%,var(--fm-border-color));color:var(--fm-danger);background:color-mix(in srgb,var(--fm-danger) 6%,var(--fm-surface))}.fm-safe-alert.is-warning{border-color:color-mix(in srgb,var(--fm-warning) 30%,var(--fm-border-color));color:var(--fm-warning);background:color-mix(in srgb,var(--fm-warning) 6%,var(--fm-surface))}.fm-safe-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,.75fr);gap:1.25rem}.fm-safe-breakdown-card,.fm-safe-context-card,.fm-safe-excluded-card,.fm-safe-unconfigured{padding:1.35rem}.fm-safe-formula{display:grid;gap:.6rem}.fm-safe-formula-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.9rem 1rem;border-radius:14px;background:var(--fm-surface-soft)}.fm-safe-formula-row.is-budget{border:1px solid color-mix(in srgb,var(--fm-indigo) 18%,var(--fm-border-color))}.fm-safe-formula-row.is-result{margin-top:.2rem;border:1px solid color-mix(in srgb,var(--fm-teal) 24%,var(--fm-border-color));background:color-mix(in srgb,var(--fm-teal) 7%,var(--fm-surface));font-size:1.05rem}.fm-safe-component-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.75rem;padding:.85rem 1rem;border:1px solid var(--fm-border-color);border-radius:14px}.fm-safe-component-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:11px;color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 9%,transparent)}.fm-safe-component-icon svg{width:17px;height:17px}.fm-safe-component-copy{display:grid;gap:.1rem;min-width:0}.fm-safe-component-copy small{color:var(--fm-text-muted);line-height:1.4}.fm-safe-component-amount{white-space:nowrap}.fm-safe-context-list{display:grid;gap:.15rem;margin:0}.fm-safe-context-list>div{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 0;border-bottom:1px solid var(--fm-border-color)}.fm-safe-context-list dt{color:var(--fm-text-muted)}.fm-safe-context-list dd{margin:0;font-weight:800;text-align:right}.fm-safe-links{display:grid;gap:.55rem;margin-top:1rem}.fm-safe-links a{display:flex;align-items:center;gap:.6rem;padding:.7rem .8rem;border-radius:12px;text-decoration:none;color:var(--fm-text);background:var(--fm-surface-soft);font-weight:750}.fm-safe-links a:hover{color:var(--fm-indigo)}.fm-safe-links svg{width:17px;height:17px}.fm-safe-unconfigured{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:1rem}.fm-safe-unconfigured h2{margin:.15rem 0 .25rem}.fm-safe-unconfigured p{margin:0;color:var(--fm-text-muted)}.fm-safe-status-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:15px}.fm-safe-status-icon.is-neutral{color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 10%,transparent)}.fm-safe-excluded-card>p{color:var(--fm-text-muted)}.fm-safe-excluded-list{display:grid;gap:.5rem}.fm-safe-excluded-list>div{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem .85rem;border-radius:12px;background:var(--fm-surface-soft)}.fm-dashboard-safe-card{display:flex;align-items:center;justify-content:space-between;gap:1.25rem;padding:1.15rem 1.25rem;margin-bottom:1.15rem;border-color:color-mix(in srgb,var(--fm-teal) 24%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-teal) 6%,var(--fm-surface)),var(--fm-surface))}.fm-dashboard-safe-card.is-overcommitted{border-color:color-mix(in srgb,var(--fm-danger) 28%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-danger) 6%,var(--fm-surface)),var(--fm-surface))}.fm-dashboard-safe-card.is-exhausted{border-color:color-mix(in srgb,var(--fm-warning) 28%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-warning) 6%,var(--fm-surface)),var(--fm-surface))}.fm-dashboard-safe-main{display:flex;align-items:center;gap:.9rem;min-width:0}.fm-dashboard-safe-icon{display:grid;place-items:center;width:46px;height:46px;border-radius:14px;color:var(--fm-teal);background:color-mix(in srgb,var(--fm-teal) 10%,transparent);flex:0 0 auto}.fm-dashboard-safe-icon svg{width:22px;height:22px}.fm-dashboard-safe-main h2{margin:.12rem 0;font-size:1.55rem}.fm-dashboard-safe-main p{margin:0;color:var(--fm-text-muted);font-size:.85rem}
@media (max-width:900px){.fm-safe-hero{align-items:stretch}.fm-safe-grid{grid-template-columns:1fr}.fm-safe-hero,.fm-safe-headline{flex-direction:column}.fm-safe-status-pill{align-self:flex-start}.fm-safe-unconfigured{grid-template-columns:auto 1fr}.fm-safe-unconfigured>.fm-button{grid-column:1/-1;justify-content:center}.fm-dashboard-safe-card{align-items:flex-start;flex-direction:column}.fm-dashboard-safe-card>.fm-button{width:100%;justify-content:center}}
@media (max-width:620px){.fm-safe-hero{padding:1.1rem}.fm-safe-hero .fm-dashboard-month-nav{width:100%;justify-content:space-between}.fm-safe-headline{padding:1.1rem}.fm-safe-component-row{grid-template-columns:auto minmax(0,1fr)}.fm-safe-component-amount{grid-column:2;text-align:left}.fm-safe-formula-row,.fm-safe-context-list>div,.fm-safe-excluded-list>div{align-items:flex-start;flex-direction:column}.fm-safe-unconfigured{grid-template-columns:1fr}.fm-safe-status-icon{width:42px;height:42px}}
.fm-goal-feasibility{display:flex;align-items:flex-start;gap:.85rem;margin:0 1.5rem 1.35rem;padding:1rem 1.1rem;border:1px solid var(--fm-border,#e2e8f0);border-radius:14px;background:var(--fm-surface-muted,#f8fafc)}.fm-goal-feasibility[hidden]{display:none!important}.fm-goal-feasibility__icon{display:grid;place-items:center;width:38px;height:38px;flex:none;border-radius:12px;background:var(--fm-lavender,#eef2ff);color:var(--fm-primary,#4f46e5)}.fm-goal-feasibility__icon svg{width:18px;height:18px}.fm-goal-feasibility strong{display:block;margin:.05rem 0 .22rem}.fm-goal-feasibility p{margin:0;color:var(--fm-text-muted,#64748b);font-size:.86rem;line-height:1.5}.fm-goal-feasibility.is-positive{border-color:color-mix(in srgb,#16a34a 35%,var(--fm-border,#e2e8f0));background:color-mix(in srgb,#16a34a 7%,var(--fm-surface,#fff))}.fm-goal-feasibility.is-warning{border-color:color-mix(in srgb,#f59e0b 45%,var(--fm-border,#e2e8f0));background:color-mix(in srgb,#f59e0b 9%,var(--fm-surface,#fff))}@media(max-width:720px){.fm-goal-feasibility{margin:0 1.1rem 1.1rem}}


/* Module 26.2 final goal header/action polish */
.fm-goal-header-nav {
    display: flex;
    align-items: center;
    margin-bottom: .8rem;
}

.fm-goal-back-button,
.fm-goal-edit-button {
    gap: .45rem;
    min-height: 38px;
}

.fm-goal-back-button svg,
.fm-goal-edit-button svg {
    width: 16px;
    height: 16px;
}

.fm-page-header--goal-detail {
    align-items: flex-start;
}

.fm-page-header--goal-detail .fm-goal-header-actions {
    align-self: flex-start;
    padding-top: .15rem;
}

.fm-page-header--goal-detail .fm-back-link {
    margin-bottom: 0;
}

@media (max-width: 720px) {
    .fm-page-header--goal-detail .fm-goal-header-actions {
        width: 100%;
        padding-top: 0;
    }

    .fm-page-header--goal-detail .fm-goal-header-actions .fm-button,
    .fm-page-header--goal-form .fm-goal-back-button {
        width: 100%;
        justify-content: center;
    }
}

/* Module 29.2 — Spending Forecast workspace */
.fm-forecast-page{display:grid;gap:1.15rem}.fm-forecast-header{align-items:center}.fm-forecast-range{display:inline-flex;align-items:center;gap:.55rem;padding:.7rem .9rem;border:1px solid var(--fm-border-color);border-radius:14px;background:var(--fm-surface);color:var(--fm-text-muted);font-size:.86rem;font-weight:750;white-space:nowrap}.fm-forecast-range svg{width:18px;height:18px;color:var(--fm-indigo)}.fm-forecast-horizon-shell{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.85rem 1rem;border:1px solid var(--fm-border-color);border-radius:18px;background:var(--fm-surface)}.fm-forecast-horizon-copy{display:grid;gap:.15rem;min-width:0}.fm-forecast-horizon-copy>span{color:var(--fm-text-muted);font-size:.82rem}.fm-forecast-horizons{display:flex;align-items:center;gap:.35rem;padding:.25rem;border-radius:13px;background:var(--fm-surface-soft)}.fm-forecast-horizon{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;min-height:38px;padding:.45rem .75rem;border-radius:10px;color:var(--fm-text-muted);font-size:.82rem;font-weight:800;text-decoration:none;white-space:nowrap}.fm-forecast-horizon:hover{color:var(--fm-text);background:var(--fm-surface)}.fm-forecast-horizon.is-active{color:var(--fm-indigo);background:var(--fm-surface);box-shadow:0 1px 3px rgba(15,23,42,.08)}.fm-forecast-horizon.is-locked{cursor:not-allowed;opacity:.68}.fm-forecast-horizon.is-locked svg{width:14px;height:14px}.fm-forecast-horizon small{padding:.12rem .35rem;border-radius:999px;background:color-mix(in srgb,var(--fm-indigo) 10%,transparent);color:var(--fm-indigo);font-size:.62rem}.fm-forecast-notice{display:flex;align-items:flex-start;gap:.75rem;padding:.9rem 1rem;border:1px solid color-mix(in srgb,var(--fm-indigo) 18%,var(--fm-border-color));border-radius:16px;background:color-mix(in srgb,var(--fm-indigo) 4%,var(--fm-surface))}.fm-forecast-notice>svg{width:19px;height:19px;flex:0 0 auto;margin-top:.08rem;color:var(--fm-indigo)}.fm-forecast-notice>div{display:grid;gap:.12rem}.fm-forecast-notice span{color:var(--fm-text-muted);font-size:.84rem;line-height:1.5}.fm-forecast-notice.is-pro{border-color:color-mix(in srgb,var(--fm-warning) 28%,var(--fm-border-color));background:color-mix(in srgb,var(--fm-warning) 5%,var(--fm-surface))}.fm-forecast-notice.is-pro>svg{color:var(--fm-warning)}.fm-forecast-summary{display:grid;grid-template-columns:1.35fr repeat(3,minmax(0,1fr));gap:.75rem}.fm-forecast-total,.fm-forecast-summary-item{min-width:0;padding:1rem 1.05rem;border:1px solid var(--fm-border-color);border-radius:17px;background:var(--fm-surface)}.fm-forecast-total{display:grid;gap:.2rem;border-color:color-mix(in srgb,var(--fm-indigo) 24%,var(--fm-border-color));background:linear-gradient(135deg,color-mix(in srgb,var(--fm-indigo) 6%,var(--fm-surface)),var(--fm-surface))}.fm-forecast-total>span,.fm-forecast-summary-item span{color:var(--fm-text-muted);font-size:.76rem;font-weight:750}.fm-forecast-total>strong{font-size:clamp(1.55rem,3vw,2.15rem);line-height:1.15;overflow-wrap:anywhere}.fm-forecast-total>small{color:var(--fm-text-muted);font-size:.72rem}.fm-forecast-summary-item{display:flex;align-items:center;gap:.75rem}.fm-forecast-summary-item>div{display:grid;gap:.18rem;min-width:0}.fm-forecast-summary-item strong{font-size:1rem;overflow-wrap:anywhere}.fm-forecast-summary-icon{display:grid;place-items:center;width:38px;height:38px;flex:0 0 auto;border-radius:12px;color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 9%,transparent)}.fm-forecast-summary-icon svg{width:18px;height:18px}.fm-forecast-layout{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(300px,.7fr);gap:1rem;align-items:start}.fm-forecast-months{min-width:0}.fm-forecast-months .fm-v2-section-heading{margin-bottom:.75rem}.fm-forecast-months .fm-v2-section-heading p a{font-weight:750}.fm-forecast-month-list{display:grid;gap:.75rem}.fm-forecast-month-card{overflow:hidden;border:1px solid var(--fm-border-color);border-radius:18px;background:var(--fm-surface)}.fm-forecast-month-card.is-over{border-color:color-mix(in srgb,var(--fm-danger) 28%,var(--fm-border-color))}.fm-forecast-month-card__header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.05rem;border-bottom:1px solid var(--fm-border-color)}.fm-forecast-month-card__header>div:first-child{display:flex;align-items:center;gap:.55rem;min-width:0}.fm-forecast-month-card__header>div:first-child>strong{font-size:1.02rem}.fm-forecast-month-total{display:grid;gap:.1rem;text-align:right}.fm-forecast-month-total small{color:var(--fm-text-muted);font-size:.7rem}.fm-forecast-month-total strong{font-size:1.02rem;white-space:nowrap}.fm-forecast-month-components{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0;border-bottom:1px solid var(--fm-border-color)}.fm-forecast-month-components>div{display:grid;gap:.3rem;padding:.85rem 1rem;border-right:1px solid var(--fm-border-color)}.fm-forecast-month-components>div:last-child{border-right:0}.fm-forecast-month-components span{display:flex;align-items:center;gap:.4rem;color:var(--fm-text-muted);font-size:.72rem;font-weight:700}.fm-forecast-month-components span svg{width:14px;height:14px}.fm-forecast-month-components strong{font-size:.9rem}.fm-forecast-budget{display:grid;gap:.55rem;padding:.85rem 1rem}.fm-forecast-budget__topline,.fm-forecast-budget__difference{display:flex;align-items:center;justify-content:space-between;gap:1rem;font-size:.78rem}.fm-forecast-budget__topline span,.fm-forecast-budget__difference span{color:var(--fm-text-muted)}.fm-forecast-budget__track{height:7px;overflow:hidden;border-radius:999px;background:var(--fm-surface-soft)}.fm-forecast-budget__track>span{display:block;height:100%;border-radius:inherit;background:var(--fm-indigo)}.fm-forecast-month-card.is-over .fm-forecast-budget__track>span{background:var(--fm-danger)}.fm-forecast-budget__difference{padding-top:.15rem}.fm-forecast-budget__difference.is-negative strong{color:var(--fm-danger)}.fm-forecast-budget-note{display:flex;align-items:center;gap:.55rem;padding:.85rem 1rem;color:var(--fm-text-muted);font-size:.78rem}.fm-forecast-budget-note svg{width:16px;height:16px;flex:0 0 auto}.fm-forecast-budget-note a{margin-left:auto;font-weight:750;white-space:nowrap}.fm-forecast-upcoming{position:sticky;top:calc(var(--fm-topbar-height,72px) + 1rem);overflow:hidden;border:1px solid var(--fm-border-color);border-radius:18px;background:var(--fm-surface)}.fm-forecast-upcoming__heading{padding:1rem 1.05rem;border-bottom:1px solid var(--fm-border-color)}.fm-forecast-upcoming__heading h2{margin:.18rem 0 .2rem;font-size:1.08rem}.fm-forecast-upcoming__heading p{margin:0;color:var(--fm-text-muted);font-size:.78rem}.fm-forecast-entry-list{display:grid}.fm-forecast-entry{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:.65rem;padding:.78rem 1rem;border-bottom:1px solid var(--fm-border-color);color:var(--fm-text);text-decoration:none}.fm-forecast-entry:hover{background:var(--fm-surface-soft)}.fm-forecast-entry__icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 8%,transparent)}.fm-forecast-entry__icon svg{width:16px;height:16px}.fm-forecast-entry__copy{display:grid;gap:.12rem;min-width:0}.fm-forecast-entry__copy strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.83rem}.fm-forecast-entry__copy small{color:var(--fm-text-muted);font-size:.7rem;line-height:1.35}.fm-forecast-entry__amount{font-size:.78rem;white-space:nowrap}.fm-forecast-more>summary{cursor:pointer;padding:.75rem 1rem;color:var(--fm-indigo);font-size:.78rem;font-weight:800;list-style:none}.fm-forecast-more>summary::-webkit-details-marker{display:none}.fm-forecast-more[open]>summary{border-bottom:1px solid var(--fm-border-color)}.fm-forecast-entry-list.is-expanded .fm-forecast-entry:last-child{border-bottom:0}.fm-forecast-empty{display:grid;justify-items:center;gap:.4rem;padding:1.5rem;text-align:center}.fm-forecast-empty>span{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;color:var(--fm-indigo);background:color-mix(in srgb,var(--fm-indigo) 9%,transparent)}.fm-forecast-empty>span svg{width:20px;height:20px}.fm-forecast-empty p{max-width:280px;margin:0;color:var(--fm-text-muted);font-size:.78rem;line-height:1.5}.fm-forecast-excluded{padding:1rem;border-top:1px solid var(--fm-border-color);background:color-mix(in srgb,var(--fm-warning) 4%,var(--fm-surface))}.fm-forecast-excluded>div{display:flex;align-items:flex-start;gap:.55rem;margin-bottom:.65rem}.fm-forecast-excluded>div>svg{width:17px;height:17px;flex:0 0 auto;margin-top:.12rem;color:var(--fm-warning)}.fm-forecast-excluded>div>span{display:grid;gap:.1rem}.fm-forecast-excluded small{color:var(--fm-text-muted);font-size:.7rem}.fm-forecast-excluded p{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin:.35rem 0 0;padding:.45rem .55rem;border-radius:9px;background:var(--fm-surface);font-size:.75rem}.fm-forecast-excluded p span{color:var(--fm-text-muted)}
@media(max-width:1120px){.fm-forecast-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.fm-forecast-layout{grid-template-columns:1fr}.fm-forecast-upcoming{position:static}}
@media(max-width:760px){.fm-forecast-header{align-items:flex-start}.fm-forecast-range{width:100%;justify-content:center}.fm-forecast-horizon-shell{align-items:stretch;flex-direction:column}.fm-forecast-horizons{overflow-x:auto;justify-content:flex-start}.fm-forecast-month-components{grid-template-columns:1fr}.fm-forecast-month-components>div{grid-template-columns:minmax(0,1fr) auto;align-items:center;border-right:0;border-bottom:1px solid var(--fm-border-color)}.fm-forecast-month-components>div:last-child{border-bottom:0}.fm-forecast-month-card__header{align-items:flex-start}.fm-forecast-budget-note{align-items:flex-start;flex-wrap:wrap}.fm-forecast-budget-note a{margin-left:0;width:100%}.fm-forecast-entry{grid-template-columns:auto minmax(0,1fr)}.fm-forecast-entry__amount{grid-column:2}}
@media(max-width:520px){.fm-forecast-summary{grid-template-columns:1fr}.fm-forecast-month-card__header{flex-direction:column}.fm-forecast-month-total{text-align:left}.fm-forecast-budget__topline,.fm-forecast-budget__difference{align-items:flex-start;flex-direction:column;gap:.2rem}.fm-forecast-horizon{min-width:max-content}}

/* Module 29.3A — Forecast information hierarchy / density corrective */
.fm-forecast-page {
    gap: .9rem;
}

.fm-forecast-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .65rem;
    min-width: 0;
}

.fm-forecast-controls__label {
    color: var(--fm-text-muted);
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
}

.fm-forecast-controls .fm-forecast-horizons {
    flex: 0 1 auto;
}

.fm-forecast-notice.is-compact {
    align-items: center;
    padding: .7rem .85rem;
    border-radius: 14px;
}

.fm-forecast-notice.is-compact > svg {
    margin-top: 0;
}

.fm-forecast-notice.is-compact > div {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    min-width: 0;
}

.fm-forecast-notice.is-compact span {
    font-size: .78rem;
}

.fm-forecast-overview__card {
    display: grid;
    grid-template-columns: minmax(210px, .8fr) minmax(0, 1.8fr);
    align-items: stretch;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 18%, var(--fm-border-color));
    border-radius: 18px;
    background: var(--fm-surface);
}

.fm-forecast-overview__total {
    display: grid;
    align-content: center;
    gap: .18rem;
    padding: .9rem 1rem;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--fm-indigo) 6%, var(--fm-surface)),
            var(--fm-surface)
        );
}

.fm-forecast-overview__total > span,
.fm-forecast-overview__metric > div > span {
    color: var(--fm-text-muted);
    font-size: .73rem;
    font-weight: 750;
}

.fm-forecast-overview__total > strong {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.fm-forecast-overview__total > small {
    color: var(--fm-text-muted);
    font-size: .69rem;
}

.fm-forecast-overview__breakdown {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fm-forecast-overview__metric {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    padding: .85rem .9rem;
    border-left: 1px solid var(--fm-border-color);
}

.fm-forecast-overview__metric > div {
    display: grid;
    gap: .14rem;
    min-width: 0;
}

.fm-forecast-overview__metric strong {
    font-size: .95rem;
    overflow-wrap: anywhere;
}

.fm-forecast-overview__metric .fm-forecast-summary-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
}

.fm-forecast-overview__metric .fm-forecast-summary-icon svg {
    width: 16px;
    height: 16px;
}

.fm-forecast-context {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .58rem .9rem;
    border-top: 1px solid var(--fm-border-color);
    color: var(--fm-text-muted);
    background: color-mix(in srgb, var(--fm-indigo) 2%, var(--fm-surface));
    font-size: .74rem;
    line-height: 1.4;
}

.fm-forecast-context > svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--fm-indigo);
}

.fm-forecast-context strong {
    color: var(--fm-text);
}

.fm-forecast-months-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .65rem;
}

.fm-forecast-months-heading h2 {
    margin: .18rem 0 0;
}

.fm-forecast-guidance {
    max-width: 500px;
    margin: 0;
    color: var(--fm-text-muted);
    font-size: .75rem;
    line-height: 1.45;
    text-align: right;
}

.fm-forecast-guidance a {
    font-weight: 750;
}

@media (max-width: 1120px) {
    .fm-forecast-overview__card {
        grid-template-columns: minmax(210px, .75fr) minmax(0, 1.45fr);
    }
}

@media (max-width: 860px) {
    .fm-forecast-controls {
        justify-content: space-between;
    }

    .fm-forecast-overview__card {
        grid-template-columns: 1fr;
    }

    .fm-forecast-overview__breakdown {
        border-top: 1px solid var(--fm-border-color);
    }

    .fm-forecast-overview__metric:first-child {
        border-left: 0;
    }

    .fm-forecast-months-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: .35rem;
    }

    .fm-forecast-guidance {
        max-width: none;
        text-align: left;
    }
}

@media (max-width: 760px) {
    .fm-forecast-controls {
        align-items: stretch;
        flex-direction: column;
        gap: .35rem;
    }

    .fm-forecast-controls__label {
        padding-left: .1rem;
    }

    .fm-forecast-notice.is-compact > div {
        align-items: flex-start;
        flex-direction: column;
        gap: .08rem;
    }
}

@media (max-width: 600px) {
    .fm-forecast-overview__breakdown {
        grid-template-columns: 1fr;
    }

    .fm-forecast-overview__metric {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding: .68rem .85rem;
        border-top: 1px solid var(--fm-border-color);
        border-left: 0;
    }

    .fm-forecast-overview__metric:first-child {
        border-top: 0;
    }

    .fm-forecast-overview__metric > div {
        display: contents;
    }

    .fm-forecast-overview__metric > div > span {
        align-self: center;
    }

    .fm-forecast-overview__metric strong {
        align-self: center;
        white-space: nowrap;
    }

    .fm-forecast-context {
        align-items: flex-start;
    }
}

/* Module 29.3B — deterministic forecast explanation / closure candidate */
.fm-forecast-explanation {
    grid-column: 1 / -1;
    border-top: 1px solid var(--fm-border-color);
}

.fm-forecast-explanation > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .58rem .9rem;
    cursor: pointer;
    color: var(--fm-text-muted);
    font-size: .74rem;
    list-style: none;
}

.fm-forecast-explanation > summary::-webkit-details-marker {
    display: none;
}

.fm-forecast-explanation > summary > span {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.fm-forecast-explanation > summary svg {
    width: 16px;
    height: 16px;
    color: var(--fm-indigo);
}

.fm-forecast-explanation > summary > svg {
    transition: transform var(--fm-transition);
}

.fm-forecast-explanation[open] > summary > svg {
    transform: rotate(180deg);
}

.fm-forecast-explanation > summary strong {
    color: var(--fm-text);
}

.fm-forecast-explanation__body {
    display: grid;
    gap: .7rem;
    padding: .8rem .9rem .9rem;
    border-top: 1px solid var(--fm-border-color);
    background: color-mix(in srgb, var(--fm-indigo) 2%, var(--fm-surface));
}

.fm-forecast-explanation__body > p,
.fm-forecast-explanation__note {
    margin: 0;
    color: var(--fm-text-muted);
    font-size: .72rem;
    line-height: 1.45;
}

.fm-forecast-explanation__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: var(--fm-surface);
}

.fm-forecast-explanation__item {
    display: grid;
    align-content: start;
    gap: .18rem;
    min-width: 0;
    padding: .7rem .8rem;
    border-left: 1px solid var(--fm-border-color);
}

.fm-forecast-explanation__item:first-child {
    border-left: 0;
}

.fm-forecast-explanation__item > span,
.fm-forecast-explanation__item > small {
    color: var(--fm-text-muted);
    font-size: .68rem;
}

.fm-forecast-explanation__item > strong {
    font-size: .78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .fm-forecast-explanation__grid {
        grid-template-columns: 1fr;
    }

    .fm-forecast-explanation__item {
        border-top: 1px solid var(--fm-border-color);
        border-left: 0;
    }

    .fm-forecast-explanation__item:first-child {
        border-top: 0;
    }
}


/* Module 30.1 — fast expense capture */
.fm-quick-expense-trigger {
    white-space: nowrap;
}

.fm-quick-expense-page {
    width: min(980px, 100%);
    margin-inline: auto;
}

.fm-quick-expense-heading {
    align-items: center;
}

.fm-keyboard-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--fm-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.fm-keyboard-hint > svg {
    width: 16px;
    height: 16px;
}

.fm-keyboard-hint kbd {
    min-width: 1.65rem;
    padding: 0.24rem 0.38rem;
    border: 1px solid var(--fm-border-color);
    border-bottom-width: 2px;
    border-radius: 7px;
    background: var(--fm-surface-muted);
    color: var(--fm-text);
    font: inherit;
    font-size: 0.68rem;
    text-align: center;
}

.fm-quick-expense-card {
    padding: 24px;
}

.fm-quick-expense-form {
    display: grid;
    gap: 1.25rem;
}

.fm-quick-expense-primary-grid,
.fm-quick-expense-secondary-grid {
    display: grid;
    gap: 1rem;
}

.fm-quick-expense-primary-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(180px, 0.8fr);
}

.fm-quick-expense-secondary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fm-recent-choice-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    margin: 0.38rem 0 0.55rem;
}

.fm-recent-choice {
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 18%, var(--fm-border-color));
    border-radius: 999px;
    background: color-mix(in srgb, var(--fm-indigo) 5%, var(--fm-surface));
    color: var(--fm-text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.38rem 0.62rem;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.fm-recent-choice:hover,
.fm-recent-choice:focus-visible {
    border-color: color-mix(in srgb, var(--fm-indigo) 52%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-indigo) 9%, var(--fm-surface));
    color: var(--fm-indigo);
    outline: none;
}

.fm-quick-expense-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fm-border-color);
}

.fm-quick-expense-emergency {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.fm-quick-expense-actions {
    justify-content: flex-end;
}

html[data-theme="dark"] .fm-recent-choice {
    background: color-mix(in srgb, var(--fm-indigo) 12%, var(--fm-surface));
}

@media (max-width: 760px) {
    .fm-keyboard-hint {
        display: none;
    }

    .fm-quick-expense-primary-grid,
    .fm-quick-expense-secondary-grid {
        grid-template-columns: 1fr;
    }

    .fm-quick-expense-card {
        padding: 18px;
    }

    .fm-quick-expense-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .fm-quick-expense-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .fm-quick-expense-actions .fm-button {
        justify-content: center;
        width: 100%;
    }
}

.fm-quick-expense-recent-label {
    display: block;
    margin-top: 0.38rem;
    color: var(--fm-text-muted);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.02em;
}


/* Module 30.1A — quick expense drawer */
.fm-quick-expense-drawer-modal {
    position: fixed;
    z-index: 1250;
    inset: 0;
    display: none;
}

.fm-quick-expense-drawer-modal.is-open {
    display: block;
}

.fm-quick-expense-drawer-modal__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgb(15 23 42 / 0.42);
    opacity: 0;
    cursor: default;
    backdrop-filter: blur(2px);
    transition: opacity 180ms ease;
}

.fm-quick-expense-drawer {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    width: min(700px, 94vw);
    height: 100dvh;
    flex-direction: column;
    border-left: 1px solid var(--fm-border-color);
    background: var(--fm-surface-soft);
    box-shadow: -24px 0 60px rgb(15 23 42 / 0.2);
    transform: translateX(100%);
    transition: transform 180ms ease;
}

.fm-quick-expense-drawer-modal.is-visible .fm-quick-expense-drawer-modal__backdrop {
    opacity: 1;
}

.fm-quick-expense-drawer-modal.is-visible .fm-quick-expense-drawer {
    transform: translateX(0);
}

.fm-quick-expense-drawer__header {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--fm-border-color);
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
    padding: 1rem 1.1rem;
    backdrop-filter: blur(12px);
}

.fm-quick-expense-drawer__header h2 {
    margin: 0.15rem 0 0.2rem;
}

.fm-quick-expense-drawer__header p {
    max-width: 470px;
    margin: 0;
    color: var(--fm-text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.fm-quick-expense-drawer__header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.fm-quick-expense-drawer__content {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem 1.1rem 1.4rem;
}

.fm-quick-expense-drawer__content .fm-quick-expense-form-shell {
    display: grid;
    gap: 1rem;
}

.fm-quick-expense-validation-summary {
    margin-bottom: 0;
}

.fm-quick-expense-drawer__loading {
    display: grid;
    gap: 0.65rem;
    padding: 0.2rem;
}

.fm-quick-expense-drawer__loading span {
    display: block;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(
        90deg,
        var(--fm-surface) 0%,
        var(--fm-surface-muted) 50%,
        var(--fm-surface) 100%
    );
    background-size: 200% 100%;
    animation: fm-quick-expense-loading 1.1s linear infinite;
}

.fm-quick-expense-drawer__loading span:first-child {
    height: 96px;
}

@keyframes fm-quick-expense-loading {
    from {
        background-position: 100% 0;
    }
    to {
        background-position: -100% 0;
    }
}

html[data-theme="dark"] .fm-quick-expense-drawer {
    background: color-mix(in srgb, var(--fm-surface) 88%, #000);
}

@media (max-width: 620px) {
    .fm-quick-expense-drawer {
        width: 100%;
        border-left: 0;
    }

    .fm-quick-expense-drawer__header,
    .fm-quick-expense-drawer__content {
        padding-right: 0.9rem;
        padding-left: 0.9rem;
    }

    .fm-quick-expense-drawer__header-actions .fm-button span {
        display: none;
    }

    .fm-quick-expense-drawer__header-actions .fm-button {
        width: 38px;
        min-width: 38px;
        padding-right: 0;
        padding-left: 0;
        justify-content: center;
    }
}

/* Module 30.1B — stable Quick Expense drawer action bar */
.fm-quick-expense-drawer__content .fm-quick-expense-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 0.85rem;
}

.fm-quick-expense-drawer__content .fm-quick-expense-emergency {
    width: 100%;
    min-height: 50px;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: color-mix(in srgb, var(--fm-surface) 92%, transparent);
}

.fm-quick-expense-drawer__content .fm-quick-expense-emergency .fm-switch-control {
    flex: 0 0 auto;
}

.fm-quick-expense-drawer__content .fm-quick-expense-emergency .fm-switch-copy {
    display: inline-block;
    min-width: 5.75rem;
    text-align: left;
}

.fm-quick-expense-drawer__content .fm-quick-expense-actions {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
}

.fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button {
    min-height: 48px;
    margin: 0;
    white-space: nowrap;
}

.fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button--secondary,
.fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button--primary {
    width: 100%;
}

.fm-quick-expense-drawer__content
    .fm-quick-expense-actions
    [data-quick-expense-drawer-close] {
    border: 1px solid var(--fm-border-color);
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
    padding-inline: 1rem;
}

.fm-quick-expense-drawer__content
    .fm-quick-expense-actions
    [data-quick-expense-drawer-close]:hover {
    border-color: color-mix(in srgb, var(--fm-indigo) 24%, var(--fm-border-color));
    background: var(--fm-surface);
}

html[data-theme="dark"]
    .fm-quick-expense-drawer__content
    .fm-quick-expense-emergency {
    background: color-mix(in srgb, var(--fm-surface) 88%, #000);
}

@media (max-width: 620px) {
    .fm-quick-expense-drawer__content .fm-quick-expense-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button {
        width: 100%;
        justify-content: center;
    }

    .fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button--primary {
        order: 1;
    }

    .fm-quick-expense-drawer__content .fm-quick-expense-actions .fm-button--secondary {
        order: 2;
    }

    .fm-quick-expense-drawer__content
        .fm-quick-expense-actions
        [data-quick-expense-drawer-close] {
        order: 3;
    }
}


/* Module 30.2 — saved/favorite expense templates */
.fm-quick-template-panel {
    display: grid;
    gap: 0.65rem;
    padding: 0.8rem;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
}

.fm-quick-template-panel__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.fm-quick-template-panel__heading > div {
    display: grid;
    gap: 0.18rem;
}

.fm-quick-template-panel__heading small,
.fm-quick-template-panel__empty {
    color: var(--fm-text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.fm-quick-template-panel__empty {
    margin: 0;
}

.fm-quick-template-favorites {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.fm-quick-template-chip {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 0.38rem;
    border: 1px solid color-mix(in srgb, var(--fm-indigo) 22%, var(--fm-border-color));
    border-radius: 999px;
    background: color-mix(in srgb, var(--fm-indigo) 6%, var(--fm-surface));
    color: var(--fm-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 750;
    padding: 0.36rem 0.65rem;
}

.fm-quick-template-chip:hover,
.fm-quick-template-chip:focus-visible {
    border-color: color-mix(in srgb, var(--fm-indigo) 55%, var(--fm-border-color));
    color: var(--fm-indigo);
    outline: none;
}

.fm-quick-template-chip svg {
    width: 14px;
    height: 14px;
}

.fm-quick-template-select-shell {
    margin-top: 0.05rem;
}

.fm-expense-template-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--fm-border-color);
    border-radius: 14px;
    background: var(--fm-surface);
}

.fm-expense-template-summary > div {
    display: grid;
    gap: 0.2rem;
}

.fm-expense-template-summary strong {
    font-size: 1rem;
}

.fm-expense-template-summary p {
    max-width: 620px;
    margin: 0;
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    text-align: right;
}

.fm-expense-templates-layout {
    display: grid;
    grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.42fr);
    align-items: start;
    gap: 1rem;
}

.fm-expense-template-create-card,
.fm-expense-template-edit-card {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
}

.fm-expense-template-create-card > h2,
.fm-expense-template-edit-card > h2 {
    margin: 0;
}

.fm-expense-template-create-card > p {
    margin: -0.25rem 0 0;
    color: var(--fm-text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.fm-expense-template-form,
.fm-expense-template-list-section {
    display: grid;
    gap: 1rem;
}

.fm-expense-template-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.fm-expense-template-form__switches {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.fm-expense-template-switch {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--fm-border-color);
    border-radius: 12px;
    background: color-mix(in srgb, var(--fm-surface) 94%, transparent);
}

.fm-expense-template-form__actions {
    justify-content: flex-end;
    padding-top: 0.2rem;
}

.fm-section-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.fm-section-heading-row h2 {
    margin: 0.12rem 0 0;
}

.fm-expense-template-list {
    display: grid;
    gap: 0.75rem;
}

.fm-expense-template-card {
    display: grid;
    gap: 0.8rem;
    padding: 0.9rem;
}

.fm-expense-template-card__main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.fm-expense-template-card__icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: var(--fm-surface-muted);
    color: var(--fm-text-muted);
}

.fm-expense-template-card__icon.is-favorite {
    background: color-mix(in srgb, var(--fm-indigo) 9%, var(--fm-surface));
    color: var(--fm-indigo);
}

.fm-expense-template-card__icon svg {
    width: 18px;
    height: 18px;
}

.fm-expense-template-card__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.fm-expense-template-card__title-row h3 {
    margin: 0;
    font-size: 0.98rem;
}

.fm-expense-template-card__main p {
    margin: 0.2rem 0 0;
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.fm-expense-template-card__emergency {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    color: var(--fm-text-muted);
    font-size: 0.72rem;
}

.fm-expense-template-card__emergency svg {
    width: 14px;
    height: 14px;
}

.fm-expense-template-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--fm-border-color);
}

.fm-expense-template-card__actions form {
    display: inline-flex;
    margin: 0;
}

.fm-button--danger-text {
    color: var(--fm-danger, #b42318);
}

.fm-expense-template-cap-state,
.fm-expense-template-empty {
    display: grid;
    justify-items: start;
    gap: 0.4rem;
}

.fm-expense-template-cap-state {
    padding: 1rem;
    border: 1px dashed var(--fm-border-color);
    border-radius: 12px;
    color: var(--fm-text-muted);
}

.fm-expense-template-cap-state svg,
.fm-expense-template-empty > svg {
    width: 22px;
    height: 22px;
    color: var(--fm-indigo);
}

.fm-expense-template-cap-state span {
    font-size: 0.78rem;
    line-height: 1.45;
}

.fm-expense-template-edit-page {
    max-width: 920px;
}

html[data-theme="dark"] .fm-quick-template-panel,
html[data-theme="dark"] .fm-expense-template-switch {
    background: color-mix(in srgb, var(--fm-surface) 88%, #000);
}

@media (max-width: 900px) {
    .fm-expense-templates-layout {
        grid-template-columns: 1fr;
    }
}

/* Module 30.2A — template UI corrective */
.fm-expense-template-form__actions {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    align-items: stretch;
    gap: 0.6rem;
}

.fm-expense-template-form__actions .fm-button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: normal;
}

.fm-expense-template-card__actions {
    display: grid;
    grid-template-columns: minmax(150px, 1.3fr) minmax(110px, 0.8fr) max-content max-content;
    align-items: stretch;
}

.fm-expense-template-card__actions form {
    display: block;
    min-width: 0;
}

.fm-expense-template-card__actions .fm-button,
.fm-expense-template-card__actions form .fm-button {
    width: 100%;
    min-width: 0;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.fm-quick-template-select-shell {
    width: 100%;
    min-width: 0;
}

.fm-quick-template-select-shell > .fm-select-input.ts-wrapper {
    width: 100%;
}

.fm-quick-template-select-shell .ts-control {
    min-height: 44px;
}

.fm-quick-template-select-shell .ts-control .item {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1180px) {
    .fm-expense-template-card__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fm-expense-template-card__actions .fm-button,
    .fm-expense-template-card__actions form .fm-button {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 620px) {
    .fm-quick-template-panel__heading,
    .fm-expense-template-summary,
    .fm-section-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .fm-expense-template-summary p {
        text-align: left;
    }

    .fm-expense-template-form__grid,
    .fm-expense-template-form__switches {
        grid-template-columns: 1fr;
    }

    .fm-expense-template-form__actions,
    .fm-expense-template-card__actions {
        grid-template-columns: 1fr;
    }

    .fm-expense-template-card__actions .fm-button,
    .fm-expense-template-card__actions form,
    .fm-expense-template-card__actions form .fm-button {
        width: 100%;
        justify-content: center;
    }
}


/* Module 30.2B — template card action composition corrective */
.fm-expense-template-card__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.fm-expense-template-card__actions > a,
.fm-expense-template-card__actions > form {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.fm-expense-template-card__actions .fm-expense-template-action,
.fm-expense-template-card__actions form .fm-expense-template-action {
    width: 100%;
    min-height: 42px;
    min-width: 0;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.fm-expense-template-action--favorite {
    border-color: var(--fm-border-color);
    background: var(--fm-surface-muted);
    color: var(--fm-text);
    box-shadow: none;
}

.fm-expense-template-action--delete {
    border: 1px solid color-mix(in srgb, var(--fm-danger, #dc2626) 28%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-danger, #dc2626) 5%, var(--fm-surface));
    color: var(--fm-danger, #dc2626);
    box-shadow: none;
}

.fm-expense-template-action--delete:hover {
    border-color: color-mix(in srgb, var(--fm-danger, #dc2626) 48%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-danger, #dc2626) 9%, var(--fm-surface));
    color: var(--fm-danger, #dc2626);
}

@media (max-width: 620px) {
    .fm-expense-template-card__actions {
        grid-template-columns: 1fr;
    }
}


/* Module 30.2C — final template-page polish */
.fm-expense-template-switch {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-content: stretch;
    gap: 0.5rem;
    min-width: 0;
    min-height: 90px;
}

.fm-expense-template-switch .fm-field-label {
    min-width: 0;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.fm-expense-template-switch .fm-switch-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-width: 0;
    justify-content: start;
}

.fm-expense-template-switch .fm-switch-copy {
    min-width: 0;
    line-height: 1.2;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
}


/* Module 31.2 / 31.2A — CSV import wizard */
.fm-import-wizard {
    max-width: 1180px;
}

.fm-import-page-heading {
    align-items: center;
}

.fm-import-page-heading > div {
    min-width: 0;
}

.fm-import-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.fm-import-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
    min-height: 72px;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
    box-shadow: var(--fm-shadow-sm);
    color: var(--fm-text-muted);
}

.fm-import-step.is-current {
    border-color: color-mix(in srgb, var(--fm-indigo) 34%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-lavender) 58%, var(--fm-surface));
    color: var(--fm-text);
}

.fm-import-step.is-complete {
    border-color: color-mix(in srgb, var(--fm-success) 24%, var(--fm-border-color));
    color: var(--fm-text);
}

.fm-import-step__marker {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    background: var(--fm-surface-soft);
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.fm-import-step.is-current .fm-import-step__marker {
    background: var(--fm-indigo);
    color: #fff;
}

.fm-import-step.is-complete .fm-import-step__marker {
    background: color-mix(in srgb, var(--fm-success) 13%, var(--fm-surface));
    color: var(--fm-success);
}

.fm-import-step__marker svg,
.fm-import-step__icon {
    width: 16px;
    height: 16px;
}

.fm-import-step__copy {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.fm-import-step__copy small {
    color: var(--fm-text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.fm-import-step__copy strong {
    overflow: hidden;
    color: inherit;
    font-size: 0.82rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-import-step__icon {
    color: var(--fm-text-muted);
}

.fm-import-step.is-current .fm-import-step__icon {
    color: var(--fm-indigo);
}

.fm-import-workspace-card {
    overflow: hidden;
    padding: 0;
}

.fm-import-card-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1.35rem 1.45rem;
    border-bottom: 1px solid var(--fm-border-color);
}

.fm-import-card-heading--compact {
    padding-bottom: 1.05rem;
}

.fm-import-card-heading > div {
    min-width: 0;
}

.fm-import-card-heading h2 {
    margin: 0.15rem 0 0.25rem;
    font-size: 1.08rem;
}

.fm-import-card-heading p,
.fm-import-gate p {
    margin: 0;
    color: var(--fm-text-muted);
    font-size: 0.86rem;
}

.fm-import-card-icon,
.fm-import-file-meta__icon,
.fm-import-section-heading__icon,
.fm-import-upload-zone__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: var(--fm-lavender);
    color: var(--fm-indigo);
}

.fm-import-card-icon svg,
.fm-import-file-meta__icon svg,
.fm-import-section-heading__icon svg,
.fm-import-upload-zone__icon svg {
    width: 20px;
    height: 20px;
}

.fm-import-gate {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.35rem;
}

.fm-import-gate h2 {
    margin: 0.25rem 0 0.35rem;
}

.fm-import-upload-card .fm-import-form {
    display: grid;
}

.fm-import-upload-zone {
    display: grid;
    gap: 1rem;
    margin: 1.4rem;
    padding: 1.2rem;
    border: 1px dashed color-mix(in srgb, var(--fm-indigo) 30%, var(--fm-border-color));
    border-radius: var(--fm-radius-lg);
    background: color-mix(in srgb, var(--fm-lavender) 26%, var(--fm-surface));
}

.fm-import-upload-zone__copy {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.fm-import-upload-zone__copy > div {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.fm-import-upload-zone__copy label {
    color: var(--fm-text);
    font-weight: 750;
}

.fm-import-upload-zone__copy small {
    color: var(--fm-text-muted);
}

.fm-import-file-input {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
    color: var(--fm-text-muted);
    padding: 0.45rem;
    font: inherit;
}

.fm-import-file-input::file-selector-button {
    min-height: 40px;
    margin-right: 0.85rem;
    border: 0;
    border-radius: 10px;
    background: var(--fm-lavender);
    color: var(--fm-indigo);
    padding: 0 0.9rem;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.fm-import-file-input:focus-visible {
    outline: none;
    border-color: var(--fm-indigo);
    box-shadow: 0 0 0 4px var(--fm-focus);
}

.fm-import-file-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.45rem;
    border-bottom: 1px solid var(--fm-border-color);
    background: color-mix(in srgb, var(--fm-surface-soft) 74%, var(--fm-surface));
}

.fm-import-file-meta__copy {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.fm-import-file-meta__copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-import-file-meta__copy span {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
}

.fm-import-form-section {
    padding: 1.35rem 1.45rem 1.5rem;
}

.fm-import-form-section + .fm-import-form-section {
    border-top: 1px solid var(--fm-border-color);
}

.fm-import-form-section--soft {
    background: color-mix(in srgb, var(--fm-surface-soft) 65%, var(--fm-surface));
}

.fm-import-section-heading {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.15rem;
}

.fm-import-section-heading > div {
    min-width: 0;
}

.fm-import-section-heading h2 {
    margin: 0;
    font-size: 1rem;
}

.fm-import-section-heading p {
    margin: 0.2rem 0 0;
    color: var(--fm-text-muted);
    font-size: 0.78rem;
}

.fm-import-mapping-grid,
.fm-import-format-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}

.fm-import-mapping-grid .fm-select-shell,
.fm-import-format-grid .fm-select-shell,
.fm-import-reference-row .fm-select-shell {
    width: 100%;
    min-width: 0;
}

.fm-import-mapping-grid .fm-select-input.ts-wrapper.single .ts-control,
.fm-import-format-grid .fm-select-input.ts-wrapper.single .ts-control,
.fm-import-reference-row .fm-select-input.ts-wrapper.single .ts-control {
    min-height: 48px;
}

.fm-import-reference-section + .fm-import-reference-section {
    margin-top: 0;
}

.fm-import-reference-labels {
    display: grid;
    grid-template-columns: minmax(180px, 0.85fr) 36px minmax(260px, 1.15fr);
    gap: 0.75rem;
    padding: 0 0.85rem 0.45rem;
    color: var(--fm-text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.fm-import-reference-list {
    display: grid;
    gap: 0.65rem;
}

.fm-import-reference-row {
    display: grid;
    grid-template-columns: minmax(180px, 0.85fr) 36px minmax(260px, 1.15fr);
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
}

.fm-import-reference-source {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.fm-import-reference-source svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--fm-indigo);
}

.fm-import-reference-source strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-import-reference-arrow {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    justify-self: center;
    border-radius: 10px;
    background: var(--fm-surface-soft);
    color: var(--fm-text-muted);
}

.fm-import-reference-arrow svg {
    width: 15px;
    height: 15px;
}

.fm-import-action-bar {
    justify-content: flex-end;
    gap: 0.7rem;
    margin: 0;
    padding: 1rem 1.45rem;
    border-top: 1px solid var(--fm-border-color);
    background: color-mix(in srgb, var(--fm-surface-soft) 72%, var(--fm-surface));
}

.fm-import-upload-card .fm-import-action-bar {
    margin-top: 0;
}

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

.fm-import-summary-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 94px;
    padding: 1rem 1.1rem;
}

.fm-import-summary-card__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: color-mix(in srgb, currentColor 10%, transparent);
}

.fm-import-summary-card__icon svg {
    width: 20px;
    height: 20px;
}

.fm-import-summary-card > div {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
}

.fm-import-summary-card span {
    color: var(--fm-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.fm-import-summary-card strong {
    color: var(--fm-text);
    font-size: 1.55rem;
    line-height: 1.05;
}

.fm-import-summary-card--neutral {
    color: var(--fm-indigo);
}

.fm-import-summary-card--success {
    color: var(--fm-success);
}

.fm-import-summary-card--danger {
    color: var(--fm-danger);
}

.fm-import-summary-card--warning {
    color: var(--fm-warning);
}

.fm-import-preview-card .fm-import-card-heading {
    border-bottom: 0;
}

.fm-import-preview-scroll {
    overflow: auto;
    max-height: 58vh;
    margin: 0 1.45rem 1.45rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
}

.fm-import-preview-table {
    margin: 0;
    min-width: 760px;
}

.fm-import-preview-table thead th {
    position: sticky;
    z-index: 1;
    top: 0;
    background: var(--fm-surface-soft);
}

.fm-import-preview-table td,
.fm-import-preview-table th {
    vertical-align: top;
}

.fm-import-preview-table td small {
    display: block;
    max-width: 34rem;
    margin-top: 0.35rem;
    color: var(--fm-text-muted);
    line-height: 1.35;
    white-space: normal;
}

.fm-import-preview-table tr.is-invalid td {
    background: color-mix(in srgb, var(--fm-danger) 6%, var(--fm-surface));
}

.fm-import-preview-table tr.is-warning td {
    background: color-mix(in srgb, var(--fm-warning) 7%, var(--fm-surface));
}

.fm-import-preview-line,
.fm-import-preview-amount {
    font-variant-numeric: tabular-nums;
}

.fm-import-preview-amount {
    white-space: nowrap;
}

.fm-import-row-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: max-content;
    border-radius: 999px;
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.fm-import-row-status svg {
    width: 14px;
    height: 14px;
}

.fm-import-row-status--success {
    background: color-mix(in srgb, var(--fm-success) 10%, transparent);
    color: var(--fm-success);
}

.fm-import-row-status--danger {
    background: color-mix(in srgb, var(--fm-danger) 10%, transparent);
    color: var(--fm-danger);
}

.fm-import-row-status--warning {
    background: color-mix(in srgb, var(--fm-warning) 12%, transparent);
    color: var(--fm-warning);
}

.fm-import-confirm-card {
    display: grid;
}

.fm-import-confirm-card .fm-import-form {
    display: grid;
}

.fm-import-decision-list {
    display: grid;
    gap: 0.8rem;
    padding: 0.2rem 1.45rem 1.35rem;
}

.fm-import-decision-row,
.fm-import-radio-option {
    position: relative;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: flex-start;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: var(--fm-surface);
    cursor: pointer;
}

.fm-import-decision-row > input,
.fm-import-radio-option > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fm-import-decision-row__indicator {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 1px solid var(--fm-border-color);
    border-radius: 7px;
    background: var(--fm-surface);
    color: transparent;
}

.fm-import-decision-row__indicator svg {
    width: 14px;
    height: 14px;
}

.fm-import-decision-row > input:checked + .fm-import-decision-row__indicator {
    border-color: var(--fm-indigo);
    background: var(--fm-indigo);
    color: #fff;
}

.fm-import-decision-row:has(input:focus-visible),
.fm-import-radio-option:has(input:focus-visible) {
    border-color: var(--fm-indigo);
    box-shadow: 0 0 0 4px var(--fm-focus);
}

.fm-import-decision-row--confirm {
    border-color: color-mix(in srgb, var(--fm-indigo) 22%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-lavender) 28%, var(--fm-surface));
}

.fm-import-duplicate-policy {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 0;
    border: 0;
    padding: 0;
}

.fm-import-duplicate-policy legend {
    grid-column: 1 / -1;
    padding: 0;
    color: var(--fm-text);
    font-size: 0.82rem;
    font-weight: 800;
}

.fm-import-radio-option {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
}

.fm-import-radio-option::before {
    width: 20px;
    height: 20px;
    border: 1px solid var(--fm-border-color);
    border-radius: 999px;
    background: var(--fm-surface);
    box-shadow: inset 0 0 0 5px var(--fm-surface);
    content: '';
}

.fm-import-radio-option:has(input:checked)::before {
    border-color: var(--fm-indigo);
    background: var(--fm-indigo);
}

.fm-import-radio-option:has(input:checked) {
    border-color: color-mix(in srgb, var(--fm-indigo) 35%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-lavender) 30%, var(--fm-surface));
}

.fm-import-discard-row {
    display: flex;
    justify-content: flex-end;
    padding: 0 1.45rem 1.35rem;
}

.fm-import-discard-row form {
    margin: 0;
}

.fm-import-confirm-card .fm-button--danger-outline {
    border-color: color-mix(in srgb, var(--fm-danger) 30%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-danger) 5%, var(--fm-surface));
    color: var(--fm-danger);
    box-shadow: none;
}

.fm-import-confirm-card .fm-button--danger-outline:hover {
    border-color: color-mix(in srgb, var(--fm-danger) 48%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-danger) 9%, var(--fm-surface));
}

@media (max-width: 1000px) {
    .fm-import-stepper,
    .fm-import-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fm-import-mapping-grid,
    .fm-import-format-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .fm-import-page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .fm-import-page-heading .fm-button {
        width: 100%;
    }

    .fm-import-file-meta {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .fm-import-file-meta .fm-status-pill {
        grid-column: 1 / -1;
    }

    .fm-import-reference-labels {
        display: none;
    }

    .fm-import-reference-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .fm-import-reference-arrow {
        transform: rotate(90deg);
    }

    .fm-import-duplicate-policy {
        grid-template-columns: 1fr;
    }

    .fm-import-action-bar {
        align-items: stretch;
    }

    .fm-import-action-bar .fm-button {
        flex: 1 1 220px;
    }
}

@media (max-width: 640px) {
    .fm-import-mapping-grid,
    .fm-import-format-grid,
    .fm-import-summary-grid {
        grid-template-columns: 1fr;
    }

    .fm-import-step {
        min-height: 66px;
    }

    .fm-import-card-heading,
    .fm-import-form-section,
    .fm-import-file-meta,
    .fm-import-action-bar {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .fm-import-upload-zone {
        margin: 1rem;
    }

    .fm-import-preview-scroll {
        margin-right: 1rem;
        margin-left: 1rem;
    }

    .fm-import-decision-list {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .fm-import-discard-row {
        padding-right: 1rem;
        padding-left: 1rem;
    }
}

@media (max-width: 480px) {
    .fm-import-stepper {
        grid-template-columns: 1fr;
    }

    .fm-import-step__copy strong {
        white-space: normal;
    }

    .fm-import-file-input::file-selector-button {
        display: block;
        width: 100%;
        margin: 0 0 0.45rem;
    }

    .fm-import-action-bar .fm-button,
    .fm-import-discard-row .fm-button {
        width: 100%;
    }

    .fm-import-discard-row,
    .fm-import-discard-row form {
        width: 100%;
    }
}

/* Module 31.2B — reference-mapping dropdown clipping corrective */
.fm-import-workspace-card--references {
    overflow: visible;
}

.fm-import-workspace-card--references .fm-import-reference-section,
.fm-import-workspace-card--references .fm-import-reference-list,
.fm-import-workspace-card--references .fm-import-reference-row,
.fm-import-workspace-card--references .fm-select-shell {
    overflow: visible;
}

.fm-import-workspace-card--references .fm-import-reference-row {
    position: relative;
}

.fm-import-workspace-card--references .fm-import-reference-row:focus-within {
    z-index: 30;
}

.fm-import-workspace-card--references .fm-select-input.ts-wrapper.dropdown-active {
    position: relative;
    z-index: 40;
}

.fm-import-workspace-card--references .ts-dropdown {
    z-index: 50;
}

.fm-import-workspace-card--references .fm-import-action-bar {
    position: relative;
    z-index: 0;
}


/* Module 31.2C — Step 3 viewport-aware Tom Select placement */
.fm-import-workspace-card--references
    .fm-select-input.ts-wrapper.fm-select-input--dropdown-above
    .ts-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    margin-top: 0;
}

.fm-import-workspace-card--references
    .fm-select-input.ts-wrapper.fm-select-input--dropdown-above
    .ts-control::after {
    transform: translateY(-65%) rotate(45deg);
}

.fm-import-workspace-card--references
    .fm-select-input.ts-wrapper.fm-select-input--dropdown-above.dropdown-active
    .ts-control::after {
    transform: translateY(-25%) rotate(225deg);
}


/* Module 31.2D — import-wizard dropdown direction corrective */
/* Reuse the viewport-aware placement for every Tom Select in the CSV import
 * wizard, including Step 2 defaults near the lower action bar. */
.fm-import-wizard
    .fm-select-input.ts-wrapper.fm-select-input--dropdown-above
    .ts-dropdown {
    top: auto !important;
    bottom: calc(100% + 8px) !important;
    margin-top: 0 !important;
}


/* Module 31.2E — final Step 4 review/decision presentation corrective */
.fm-import-preview-scroll {
    background: var(--fm-surface);
    scrollbar-gutter: stable;
}

.fm-import-preview-table {
    width: 100%;
    min-width: 920px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

.fm-import-preview-col--line {
    width: 76px;
}

.fm-import-preview-col--date {
    width: 150px;
}

.fm-import-preview-col--title {
    width: 24%;
}

.fm-import-preview-col--amount {
    width: 150px;
}

.fm-import-preview-col--status {
    width: auto;
}

.fm-import-preview-table thead th {
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid var(--fm-border-color);
    color: var(--fm-text-muted);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    line-height: 1.2;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.fm-import-preview-table tbody td {
    padding: 0.82rem 0.85rem;
    border-bottom: 1px solid color-mix(in srgb, var(--fm-border-color) 72%, transparent);
    color: var(--fm-text);
    line-height: 1.35;
}

.fm-import-preview-table tbody tr:last-child td {
    border-bottom: 0;
}

.fm-import-preview-table tbody tr:hover td {
    background: color-mix(in srgb, var(--fm-lavender) 18%, var(--fm-surface));
}

.fm-import-preview-table tr.is-invalid:hover td {
    background: color-mix(in srgb, var(--fm-danger) 9%, var(--fm-surface));
}

.fm-import-preview-table tr.is-warning:hover td {
    background: color-mix(in srgb, var(--fm-warning) 11%, var(--fm-surface));
}

.fm-import-preview-line,
.fm-import-preview-date,
.fm-import-preview-amount {
    color: var(--fm-text-muted);
    font-variant-numeric: tabular-nums;
}

.fm-import-preview-date,
.fm-import-preview-amount {
    white-space: nowrap;
}

.fm-import-preview-title strong {
    display: block;
    overflow-wrap: anywhere;
    color: var(--fm-text);
    font-weight: 750;
}

.fm-import-preview-status {
    min-width: 0;
}

.fm-import-row-state {
    display: grid;
    justify-items: start;
    gap: 0.35rem;
    min-width: 0;
}

.fm-import-row-state small,
.fm-import-preview-table td .fm-import-row-state small {
    max-width: none;
    margin: 0;
    line-height: 1.4;
}

.fm-import-confirm-card .fm-import-card-heading {
    background: color-mix(in srgb, var(--fm-surface-soft) 52%, var(--fm-surface));
}

.fm-import-decision-list {
    gap: 0.9rem;
    padding-top: 1.1rem;
}

.fm-import-decision-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-height: 58px;
}

.fm-import-decision-row > span:last-child {
    min-width: 0;
    line-height: 1.4;
}

.fm-import-duplicate-policy {
    padding: 0.95rem;
    border: 1px solid var(--fm-border-color);
    border-radius: var(--fm-radius-md);
    background: color-mix(in srgb, var(--fm-surface-soft) 62%, var(--fm-surface));
}

.fm-import-duplicate-policy legend {
    padding: 0 0.35rem;
}

.fm-import-radio-option {
    min-height: 58px;
}

.fm-import-discard-row {
    justify-content: flex-start;
    padding-top: 0.95rem;
    border-top: 1px dashed color-mix(in srgb, var(--fm-border-color) 76%, transparent);
}

@media (max-width: 760px) {
    .fm-import-preview-table {
        min-width: 760px;
    }

    .fm-import-preview-scroll {
        max-height: none;
    }
}

@media (max-width: 480px) {
    .fm-import-preview-table {
        min-width: 720px;
    }
}


/* Module 31.3 — CSV import history */
.fm-import-history-privacy {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
}
.fm-import-history-privacy > div {
    min-width: 0;
}
.fm-import-history-privacy strong {
    display: block;
    margin-bottom: 0.18rem;
}
.fm-import-history-privacy p {
    margin: 0;
    color: var(--fm-text-muted, #64748b);
}
.fm-import-history-card {
    padding: 0;
    overflow: hidden;
}
.fm-import-history-table-wrap {
    width: 100%;
    overflow-x: auto;
    scrollbar-gutter: stable;
}
.fm-import-history-table {
    min-width: 980px;
    margin: 0;
}
.fm-import-history-table th,
.fm-import-history-table td {
    vertical-align: middle;
}
.fm-import-history-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    max-width: 280px;
}
.fm-import-history-file svg {
    width: 16px;
    height: 16px;
    flex: none;
    color: var(--fm-primary, #4f46e5);
}
.fm-import-history-file {
    overflow-wrap: anywhere;
}
.fm-import-history-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.fm-import-history-count--success {
    background: color-mix(in srgb, var(--fm-success, #16a34a) 12%, transparent);
    color: var(--fm-success, #15803d);
}
@media (max-width: 720px) {
    .fm-import-history-privacy {
        align-items: flex-start;
    }
}


/* Module 32.1 — Privacy Mode global control */
.fm-privacy-mode-toggle.is-active {
    border-color: color-mix(in srgb, var(--fm-primary, #4f46e5) 38%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 10%, var(--fm-surface));
    color: var(--fm-primary, #4f46e5);
}

.fm-privacy-mode-toggle.is-active:hover {
    border-color: color-mix(in srgb, var(--fm-primary, #4f46e5) 52%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 14%, var(--fm-surface));
}

.fm-privacy-mode-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}


/* Module 33.1 — onboarding progress visibility / card polish */
.fm-onboarding-topbar-progress {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    min-height: 36px;
    padding: .42rem .62rem .5rem;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--fm-primary, #4f46e5) 26%, var(--fm-border-color));
    border-radius: 11px;
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 5%, var(--fm-surface));
    color: var(--fm-primary, #4f46e5);
    box-shadow: var(--fm-shadow-sm);
    text-decoration: none;
    transition:
        transform var(--fm-transition),
        border-color var(--fm-transition),
        background var(--fm-transition);
}

.fm-onboarding-topbar-progress:hover,
.fm-onboarding-topbar-progress.is-active {
    border-color: color-mix(in srgb, var(--fm-primary, #4f46e5) 48%, var(--fm-border-color));
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 10%, var(--fm-surface));
    transform: translateY(-1px);
}

.fm-onboarding-topbar-progress__icon {
    display: grid;
    width: 23px;
    height: 23px;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 12%, transparent);
}

.fm-onboarding-topbar-progress__icon svg {
    width: 15px;
    height: 15px;
}

.fm-onboarding-topbar-progress strong {
    font-size: .78rem;
    line-height: 1;
    letter-spacing: .01em;
}

.fm-onboarding-topbar-progress__track {
    position: absolute;
    right: 6px;
    bottom: 3px;
    left: 6px;
    height: 2px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 13%, transparent);
}

.fm-onboarding-topbar-progress__track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--fm-primary, #4f46e5);
}

.fm-onboarding-page {
    max-width: 1240px;
    margin-inline: auto;
}

.fm-onboarding-heading {
    align-items: flex-end;
}

.fm-onboarding-progress-card,
.fm-onboarding-start-card,
.fm-onboarding-finish-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.fm-onboarding-progress-card__copy {
    min-width: 0;
}

.fm-onboarding-progress-card__copy strong {
    display: block;
    margin-top: .2rem;
    font-size: 1.15rem;
}

.fm-onboarding-progress-card__copy p,
.fm-onboarding-start-card p,
.fm-onboarding-finish-card p {
    margin: .35rem 0 0;
    color: var(--fm-text-muted, #64748b);
}

.fm-onboarding-progress-card__meter {
    width: min(360px, 42%);
    flex: none;
}

.fm-onboarding-progress-card__meter > span {
    display: block;
    margin-bottom: .4rem;
    font-weight: 800;
    text-align: right;
}

.fm-onboarding-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--fm-surface-muted, #f1f5f9);
}

.fm-onboarding-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--fm-primary, #4f46e5);
    transition: width .2s ease;
}

.fm-onboarding-start-card__icon {
    display: grid;
    width: 50px;
    height: 50px;
    flex: none;
    place-items: center;
    border-radius: 15px;
    background: var(--fm-lavender, #eef2ff);
    color: var(--fm-primary, #4f46e5);
}

.fm-onboarding-start-card__icon svg {
    width: 22px;
    height: 22px;
}

.fm-onboarding-start-card > div:nth-child(2),
.fm-onboarding-finish-card > div {
    min-width: 0;
    flex: 1;
}

.fm-onboarding-start-card h2,
.fm-onboarding-finish-card h2 {
    margin: 0;
    font-size: 1.08rem;
}

.fm-onboarding-inline-form {
    margin: 0;
}

.fm-onboarding-complete-notice > div {
    display: grid;
    gap: .15rem;
}

.fm-onboarding-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.fm-onboarding-step {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 260px;
    flex-direction: column;
    gap: 1rem;
    padding: 1.1rem;
    overflow: hidden;
    transition:
        transform var(--fm-transition),
        border-color var(--fm-transition),
        box-shadow var(--fm-transition);
}

.fm-onboarding-step:hover {
    transform: translateY(-2px);
}

.fm-onboarding-step[data-onboarding-kind="required"] {
    border-color: color-mix(in srgb, var(--fm-primary, #4f46e5) 22%, var(--fm-border-color));
    background: linear-gradient(
        145deg,
        color-mix(in srgb, var(--fm-primary, #4f46e5) 4%, var(--fm-surface)),
        var(--fm-surface) 58%
    );
}

.fm-onboarding-step[data-onboarding-kind="optional"] {
    border-color: color-mix(in srgb, #f59e0b 24%, var(--fm-border-color));
    background: linear-gradient(
        145deg,
        color-mix(in srgb, #f59e0b 4%, var(--fm-surface)),
        var(--fm-surface) 58%
    );
}

.fm-onboarding-step--complete {
    border-color: color-mix(in srgb, #16a34a 34%, var(--fm-border-color)) !important;
    background: linear-gradient(
        145deg,
        color-mix(in srgb, #16a34a 7%, var(--fm-surface)),
        var(--fm-surface) 62%
    ) !important;
}

.fm-onboarding-step--skipped {
    border-color: color-mix(in srgb, #64748b 20%, var(--fm-border-color)) !important;
    background: color-mix(in srgb, #64748b 3%, var(--fm-surface)) !important;
}

.fm-onboarding-step[data-onboarding-current="true"] {
    box-shadow: 0 15px 36px color-mix(in srgb, var(--fm-primary, #4f46e5) 13%, transparent);
}

.fm-onboarding-step__topline,
.fm-onboarding-step__identity,
.fm-onboarding-step__badges,
.fm-onboarding-step__action-buttons {
    display: flex;
    align-items: center;
}

.fm-onboarding-step__topline {
    justify-content: space-between;
    gap: .75rem;
}

.fm-onboarding-step__identity {
    gap: .55rem;
}

.fm-onboarding-step__badges,
.fm-onboarding-step__action-buttons {
    gap: .42rem;
    flex-wrap: wrap;
}

.fm-onboarding-step__number,
.fm-onboarding-step__icon {
    display: grid;
    place-items: center;
    flex: none;
}

.fm-onboarding-step__number {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--fm-surface-muted, #f8fafc);
    color: var(--fm-text-muted, #64748b);
    font-size: .78rem;
    font-weight: 850;
}

.fm-onboarding-step__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 10%, var(--fm-surface));
    color: var(--fm-primary, #4f46e5);
}

.fm-onboarding-step[data-onboarding-kind="optional"] .fm-onboarding-step__icon {
    background: color-mix(in srgb, #f59e0b 11%, var(--fm-surface));
    color: #b45309;
}

.fm-onboarding-step--complete .fm-onboarding-step__number,
.fm-onboarding-step--complete .fm-onboarding-step__icon {
    background: color-mix(in srgb, #16a34a 12%, var(--fm-surface));
    color: #15803d;
}

.fm-onboarding-step--skipped .fm-onboarding-step__number,
.fm-onboarding-step--skipped .fm-onboarding-step__icon {
    background: color-mix(in srgb, #64748b 8%, var(--fm-surface));
    color: var(--fm-text-muted, #64748b);
}

.fm-onboarding-step__number svg,
.fm-onboarding-step__icon svg {
    width: 17px;
    height: 17px;
}

.fm-onboarding-step__content {
    display: grid;
    gap: .4rem;
}

.fm-onboarding-step__content h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
}

.fm-onboarding-step__content p {
    margin: 0;
    color: var(--fm-text-muted, #64748b);
    font-size: .84rem;
    line-height: 1.5;
}

.fm-onboarding-kind,
.fm-onboarding-state {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: .2rem .52rem;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.fm-onboarding-kind--required {
    background: color-mix(in srgb, var(--fm-primary, #4f46e5) 10%, var(--fm-surface));
    color: var(--fm-primary, #4f46e5);
}

.fm-onboarding-kind--optional {
    background: color-mix(in srgb, #f59e0b 11%, var(--fm-surface));
    color: #b45309;
}

.fm-onboarding-state {
    background: var(--fm-surface-muted, #f8fafc);
    color: var(--fm-text-muted, #64748b);
}

.fm-onboarding-state--complete {
    background: color-mix(in srgb, #16a34a 10%, var(--fm-surface));
    color: #15803d;
}

.fm-onboarding-state--skipped {
    background: color-mix(in srgb, #64748b 8%, var(--fm-surface));
    color: var(--fm-text-muted, #64748b);
}

.fm-onboarding-step__actions {
    display: grid;
    gap: .65rem;
    margin-top: auto;
    padding-top: .85rem;
    border-top: 1px solid color-mix(in srgb, var(--fm-border-color) 85%, transparent);
}

.fm-onboarding-step__action-buttons {
    align-items: stretch;
}

.fm-onboarding-step__action-buttons .fm-button {
    justify-content: center;
}

.fm-onboarding-current-value {
    color: var(--fm-text-muted, #64748b);
    font-size: .78rem;
}

.fm-onboarding-current-value strong {
    color: var(--fm-text, #111827);
}

@media (max-width: 1080px) {
    .fm-onboarding-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .fm-onboarding-heading,
    .fm-onboarding-progress-card,
    .fm-onboarding-start-card,
    .fm-onboarding-finish-card {
        align-items: stretch;
        flex-direction: column;
    }

    .fm-onboarding-progress-card__meter {
        width: 100%;
    }

    .fm-onboarding-heading .fm-button,
    .fm-onboarding-start-card .fm-button,
    .fm-onboarding-finish-card .fm-button {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .fm-onboarding-steps {
        grid-template-columns: 1fr;
    }

    .fm-onboarding-step {
        min-height: 0;
    }

    .fm-onboarding-step__action-buttons .fm-button,
    .fm-onboarding-step__action-buttons .fm-inline-form {
        width: 100%;
    }

    .fm-onboarding-step__action-buttons .fm-inline-form .fm-button {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .fm-onboarding-topbar-progress {
        gap: .3rem;
        padding-inline: .48rem;
    }

    .fm-onboarding-topbar-progress__icon {
        width: 21px;
        height: 21px;
    }

    .fm-onboarding-step__topline {
        align-items: flex-start;
    }

    .fm-onboarding-step__badges {
        justify-content: flex-end;
    }
}


/* Module 33.3 — guided empty states and contextual CTAs */
.fm-guided-empty-state {
    display: grid;
    justify-items: center;
    gap: .8rem;
    padding: clamp(2rem, 5vw, 3.5rem) 1.25rem;
    text-align: center;
}
.fm-guided-empty-state__icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 16px;
    background: color-mix(in srgb, var(--fm-indigo) 9%, var(--fm-surface));
    color: var(--fm-indigo);
}
.fm-guided-empty-state__icon svg { width: 24px; height: 24px; }
.fm-guided-empty-state__copy { display: grid; gap: .35rem; max-width: 560px; }
.fm-guided-empty-state__copy h3 { margin: 0; font-size: 1.05rem; }
.fm-guided-empty-state__copy p { margin: 0; color: var(--fm-text-muted); line-height: 1.55; }
.fm-guided-empty-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.fm-dashboard-guided-empty { gap: .65rem; }
.fm-guided-empty-surface { transition: border-color .18s ease, background-color .18s ease; }
@media (max-width: 640px) {
    .fm-guided-empty-state__actions { width: 100%; }
    .fm-guided-empty-state__actions .fm-button { width: 100%; justify-content: center; }
}

/* Module 33.4 — privacy-safe activation metrics */
.fm-activation-admin { gap:1rem; }
.fm-activation-window-card {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
}
.fm-activation-window-card h2 { margin:.2rem 0 .25rem; }
.fm-activation-window-card p { margin:0; color:var(--fm-text-muted,#64748b); }
.fm-activation-window-tabs { display:flex; gap:.45rem; flex-wrap:wrap; justify-content:flex-end; }
.fm-activation-hero {
  display:flex;
  align-items:center;
  gap:1rem;
  background:linear-gradient(135deg,color-mix(in srgb,var(--fm-primary,#4f46e5) 7%,var(--fm-surface,#fff)),var(--fm-surface,#fff));
}
.fm-activation-hero__icon,
.fm-activation-metric__icon,
.fm-activation-privacy__icon {
  display:grid;
  place-items:center;
  width:46px;
  height:46px;
  flex:none;
  border-radius:14px;
  color:var(--fm-primary,#4f46e5);
  background:color-mix(in srgb,var(--fm-primary,#4f46e5) 10%,transparent);
}
.fm-activation-hero > div:last-child { display:grid; gap:.12rem; }
.fm-activation-hero span,
.fm-activation-hero small,
.fm-activation-metric span,
.fm-activation-metric small { color:var(--fm-text-muted,#64748b); }
.fm-activation-hero strong { font-size:2rem; line-height:1; letter-spacing:-.04em; }
.fm-activation-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:.75rem; }
.fm-activation-grid--three { grid-template-columns:repeat(3,minmax(0,1fr)); }
.fm-activation-metric {
  display:flex;
  align-items:flex-start;
  gap:.75rem;
  min-height:142px;
  padding:1rem;
  border:1px solid var(--fm-border,#e2e8f0);
  border-radius:16px;
  background:var(--fm-surface-muted,#f8fafc);
}
.fm-activation-metric.is-primary {
  border-color:color-mix(in srgb,var(--fm-primary,#4f46e5) 30%,var(--fm-border,#e2e8f0));
  background:color-mix(in srgb,var(--fm-primary,#4f46e5) 6%,var(--fm-surface,#fff));
}
.fm-activation-metric > div { display:grid; gap:.15rem; min-width:0; }
.fm-activation-metric strong { font-size:1.65rem; line-height:1.1; letter-spacing:-.035em; }
.fm-activation-privacy { display:flex; align-items:flex-start; gap:1rem; }
.fm-activation-privacy h2 { margin:.05rem 0 .3rem; }
.fm-activation-privacy p { margin:0; max-width:900px; color:var(--fm-text-muted,#64748b); line-height:1.55; }
@media(max-width:1100px){
  .fm-activation-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .fm-activation-grid--three { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:760px){
  .fm-activation-window-card { align-items:flex-start; flex-direction:column; }
  .fm-activation-window-tabs { width:100%; justify-content:flex-start; }
  .fm-activation-grid,
  .fm-activation-grid--three { grid-template-columns:1fr; }
}

/* Module 35.1A — Scheduled export configuration UI/UX polish */
.fm-page-header--scheduled-export-form {
    max-width: 1120px;
    margin-bottom: 1rem;
}

.fm-page-header--scheduled-export-form > div {
    max-width: 860px;
}

.fm-scheduled-export-form-card {
    width: 100%;
    max-width: 1120px;
    padding: 0;
    overflow: hidden;
}

.fm-scheduled-export-form {
    display: grid;
}

.fm-scheduled-export-form-section {
    padding: 1.5rem 1.65rem;
}

.fm-scheduled-export-form-section + .fm-scheduled-export-form-section {
    border-top: 1px solid var(--fm-border, #e2e8f0);
}

.fm-scheduled-export-form-section__heading {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    margin-bottom: 1.15rem;
}

.fm-scheduled-export-form-section__heading > div {
    min-width: 0;
}

.fm-scheduled-export-form-section__heading h2 {
    margin: .05rem 0 0;
    font-size: 1.05rem;
}

.fm-scheduled-export-form-section__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: var(--fm-lavender, #eef2ff);
    color: var(--fm-primary, #4f46e5);
}

.fm-scheduled-export-form-section__icon svg {
    width: 19px;
    height: 19px;
}

.fm-scheduled-export-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.1rem;
}

.fm-scheduled-export-form .fm-field {
    min-width: 0;
}

.fm-scheduled-export-form .fm-field > label,
.fm-scheduled-export-form .input > label {
    display: block;
    margin-bottom: .42rem;
    color: var(--fm-text, #111827);
    font-size: .82rem;
    font-weight: 750;
}

.fm-scheduled-export-form .input {
    margin: 0;
}

.fm-scheduled-export-form .fm-input-shell,
.fm-scheduled-export-form .fm-select-shell {
    width: 100%;
}

.fm-scheduled-export-form .fm-input,
.fm-scheduled-export-form .ts-control {
    width: 100%;
    min-height: 50px;
}

.fm-scheduled-export-form .fm-field-help {
    display: block;
    margin-top: .38rem;
    color: var(--fm-text-muted, #64748b);
    font-size: .76rem;
    line-height: 1.45;
}

.fm-scheduled-export-form [data-scheduled-export-report-field][hidden],
.fm-scheduled-export-form [data-scheduled-export-cadence-field][hidden] {
    display: none !important;
}

.fm-scheduled-export-delivery-panel {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    margin: 0 1.65rem 1.4rem;
    padding: 1rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--fm-primary, #4f46e5) 18%, var(--fm-border, #e2e8f0));
    border-radius: 15px;
    background: color-mix(in srgb, var(--fm-lavender, #eef2ff) 42%, var(--fm-surface, #fff));
}

.fm-scheduled-export-delivery-panel__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    background: var(--fm-surface, #fff);
    color: var(--fm-primary, #4f46e5);
    box-shadow: 0 5px 14px rgba(15, 23, 42, .06);
}

.fm-scheduled-export-delivery-panel__icon svg {
    width: 19px;
    height: 19px;
}

.fm-scheduled-export-delivery-panel__copy {
    display: grid;
    gap: .18rem;
    min-width: 0;
}

.fm-scheduled-export-delivery-panel__copy strong {
    font-size: .98rem;
}

.fm-scheduled-export-delivery-panel__copy p,
.fm-scheduled-export-delivery-panel__copy small {
    margin: 0;
    color: var(--fm-text-muted, #64748b);
    line-height: 1.5;
}

.fm-scheduled-export-delivery-panel__copy p {
    font-size: .82rem;
}

.fm-scheduled-export-delivery-panel__copy small {
    margin-top: .15rem;
    font-size: .74rem;
}

.fm-scheduled-export-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    justify-content: flex-end;
    margin: 0;
    padding: 1rem 1.65rem;
    border-top: 1px solid var(--fm-border, #e2e8f0);
    background: color-mix(in srgb, var(--fm-surface-muted, #f8fafc) 94%, transparent);
    backdrop-filter: blur(8px);
}

@media (max-width: 760px) {
    .fm-scheduled-export-form-grid {
        grid-template-columns: 1fr;
    }

    .fm-scheduled-export-form-grid .fm-field--span-2 {
        grid-column: auto;
    }

    .fm-scheduled-export-form-section {
        padding: 1.2rem;
    }

    .fm-scheduled-export-delivery-panel {
        margin: 0 1.2rem 1.2rem;
    }

    .fm-scheduled-export-form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
        padding: .9rem 1.2rem;
    }

    .fm-scheduled-export-form-actions .fm-button {
        width: 100%;
        justify-content: center;
    }
}

/* Original Module 43 — integrated account settings, without changing auth controls. */
.fm-account-settings-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.fm-account-settings-nav__item {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
    padding: 17px 15px;
    border: 1px solid var(--fm-border-color);
    border-radius: 16px;
    background: var(--fm-surface);
    text-decoration: none;
    color: var(--fm-text);
    transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.fm-account-settings-nav__item:hover {
    border-color: var(--fm-indigo);
    box-shadow: var(--fm-shadow-sm);
    transform: translateY(-1px);
}
.fm-account-settings-nav__item:focus-visible {
    outline: 3px solid var(--fm-focus);
    outline-offset: 3px;
}
.fm-account-settings-nav__item > svg:first-child,
.fm-account-settings-nav__item > i:first-child {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--fm-indigo);
}
.fm-account-settings-nav__item > svg:last-child,
.fm-account-settings-nav__item > i:last-child {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-left: auto;
    color: var(--fm-text-muted);
}
.fm-account-settings-nav__item span {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}
.fm-account-settings-nav__item strong { font-size: .9rem; line-height: 1.3; }
.fm-account-settings-nav__item small {
    color: var(--fm-text-muted);
    font-size: .75rem;
    line-height: 1.4;
}
.fm-account-settings-section { scroll-margin-top: 95px; }
.fm-account-privacy-card { display: grid; gap: 14px; }
.fm-account-privacy-card .fm-card-heading { gap: 12px; align-items: flex-start; }
.fm-account-privacy-card .fm-card-heading p { margin: 6px 0 0; color: var(--fm-text-muted); }
.fm-account-privacy-status {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    border-radius: 100px;
    border: 1px solid var(--fm-border-color);
    background: var(--fm-surface-soft);
    padding: 6px 10px;
    font-size: .76rem;
    font-weight: 650;
    color: var(--fm-text-muted);
}
.fm-account-privacy-status.is-enabled { color: var(--fm-teal); border-color: var(--fm-teal); }
.fm-account-privacy-form { display: flex; }
.fm-account-preferences-backlinks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 1120px) {
    .fm-account-settings-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .fm-account-settings-nav { grid-template-columns: minmax(0, 1fr); }
    .fm-account-settings-nav__item { padding: 12px 14px; }
    .fm-account-privacy-card .fm-card-heading { flex-direction: column; }
    .fm-account-preferences-backlinks { flex-direction: column; align-items: stretch; }
    .fm-account-preferences-backlinks .fm-button { width: 100%; }
}
