/* =========================================================================
   1. Design Tokens
   ========================================================================= */
:root {
    /* Typography */
    --font-sans:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
        "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
        "Helvetica Neue", sans-serif;
    --font-weight-medium: 500;
    --font-weight-bold: 800;
    --font-weight-heavy: 850;

    /* Brand & surface colors */
    --color-brand-700: #0b744e;
    --color-brand-800: #07533a;
    --color-brand-hover-from: #169767;
    --color-brand-hover-to: #064b34;
    --color-brand-from: #12875c;
    --color-accent-mint: #dceee0;
    --color-accent-sage: #9fbc8f;

    --color-bg: #f7f0e5;
    --color-bg-card: #fffefa;
    --color-surface: #fff;
    --color-border: #e8dfd2;
    --color-border-input: #cecece;
    --color-border-checkbox: #a8b4ae;

    --color-text: #142620;
    --color-text-strong: #111f1b;
    --color-text-muted: #68766f;
    --color-text-placeholder: #848b87;
    --color-text-icon: #6d7772;

    /* Status colors */
    --color-danger: #8a2f24;
    --color-danger-bg: #fff4f0;
    --color-danger-border: #f0cbc2;
    --color-flash-bg: #fff8e8;
    --color-flash-border: #eadbbf;

    /* Radii */
    --radius-sm: 3px;
    --radius-md: 12px;
    --radius-xl: 30px;

    /* Shadows */
    --shadow-card:
        0 20px 50px rgba(47, 65, 45, 0.14), 0 6px 18px rgba(47, 65, 45, 0.08);
    --shadow-input-inset: inset 0 1px 2px rgba(20, 38, 32, 0.03);
    --shadow-button: 0 11px 20px rgba(7, 83, 58, 0.25);
    --shadow-button-hover: 0 13px 22px rgba(7, 83, 58, 0.28);
    --shadow-button-active: 0 8px 16px rgba(7, 83, 58, 0.22);

    /* Focus ring (shared across all interactive auth elements) */
    --focus-ring: 3px solid rgba(11, 116, 78, 0.2);
    --focus-ring-offset: 3px;

    /* Motion */
    --transition-base: 160ms ease;

    /* Layout */
    --page-padding-y: 3rem;
    --page-padding-x: 6rem;
}

/* =========================================================================
   2. Base
   ========================================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

html,
body,
td,
input,
button,
textarea {
    font-family: var(--font-sans);
}

body {
    color: var(--color-text);
    margin: 0;
}

a {
    color: var(--color-brand-700);
}

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

label {
    font-weight: var(--font-weight-medium);
}

input,
button,
textarea {
    font: inherit;
}

/* =========================================================================
   3. App Shell
   ========================================================================= */
.app-body {
    background:
        radial-gradient(
            circle at 30% -10%,
            rgba(220, 238, 224, 0.72),
            transparent 34rem
        ),
        #fbfaf7;
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
    min-height: 100svh;
}

.app-sidebar {
    display: none;
}

.app-content {
    min-height: 100vh;
    min-height: 100svh;
    min-width: 0;
}

.app-mobile-header {
    align-items: center;
    background: rgba(251, 250, 247, 0.92);
    display: flex;
    justify-content: space-between;
    left: 0;
    padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
    position: sticky;
    right: 0;
    top: 0;
    z-index: 20;
}

.app-mobile-brand,
.app-brand {
    align-items: center;
    color: var(--color-text-strong);
    display: inline-flex;
    text-decoration: none;
}

.app-mobile-brand {
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    gap: 0.55rem;
}

.app-brand {
    gap: 0.7rem;
}

.app-brand:hover,
.app-mobile-brand:hover {
    color: var(--color-text-strong);
}

.app-brand span {
    display: grid;
    gap: 0.1rem;
}

.app-brand strong {
    font-size: 1rem;
    line-height: 1.05;
}

.app-brand small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.15;
}

.app-brand-mark {
    display: block;
    height: 2rem;
    width: 2rem;
}

.app-mobile-actions {
    align-items: center;
    display: inline-flex;
    gap: 0.5rem;
}

.app-icon-button {
    align-items: center;
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    display: inline-flex;
    height: 2.35rem;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    width: 2.35rem;
}

.app-icon-button svg {
    height: 1.08rem;
    width: 1.08rem;
}

.finance-space-switcher {
    min-width: 0;
    position: relative;
}

.finance-space-switcher summary {
    align-items: center;
    background: #f5faf6;
    border: 1px solid #d7e6db;
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    gap: 0.55rem;
    justify-content: space-between;
    list-style: none;
    min-height: 3.2rem;
    padding: 0.65rem 0.75rem;
}

.finance-space-switcher summary::-webkit-details-marker {
    display: none;
}

.finance-space-switcher summary span {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.finance-space-switcher summary small,
.finance-space-switcher-option small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    line-height: 1.15;
}

.finance-space-switcher summary strong,
.finance-space-switcher-option strong {
    color: var(--color-text-strong);
    font-size: 0.88rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.finance-space-switcher summary > svg {
    color: var(--color-text-muted);
    flex: 0 0 auto;
    height: 1rem;
    width: 1rem;
}

.finance-space-switcher--brand {
    display: block;
}

.finance-space-switcher--brand summary,
.finance-space-switcher--mobile-brand summary {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: var(--color-text-strong);
    min-height: 2.35rem;
    padding: 0;
}

.finance-space-switcher--brand summary {
    gap: 0.7rem;
    justify-content: flex-start;
}

.finance-space-switcher--brand summary > span {
    flex: 1 1 auto;
}

.finance-space-switcher--brand summary strong {
    font-size: 1rem;
    line-height: 1.05;
}

.finance-space-switcher--brand summary small {
    font-weight: var(--font-weight-medium);
}

.finance-space-switcher--brand summary > svg {
    margin-left: auto;
}

.finance-space-switcher-menu {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(20, 38, 32, 0.14);
    display: grid;
    gap: 0.25rem;
    left: 0;
    margin-top: 0.45rem;
    min-width: min(18rem, calc(100vw - 2rem));
    padding: 0.45rem;
    position: absolute;
    right: 0;
    z-index: 60;
}

.finance-space-switcher-option,
.finance-space-switcher-action {
    align-items: center;
    border-radius: 8px;
    color: var(--color-text);
    display: flex;
    gap: 0.55rem;
    min-width: 0;
    text-decoration: none;
}

.finance-space-switcher-option {
    justify-content: space-between;
    padding: 0.62rem 0.65rem;
}

.finance-space-switcher-option span {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.finance-space-switcher-option:hover,
.finance-space-switcher-option.is-active,
.finance-space-switcher-action:hover {
    background: #edf6ef;
    color: var(--color-brand-800);
}

.finance-space-switcher-option svg,
.finance-space-switcher-action svg {
    color: var(--color-brand-700);
    flex: 0 0 auto;
    height: 1rem;
    width: 1rem;
}

.finance-space-switcher-action {
    border-top: 1px solid var(--color-border);
    color: var(--color-brand-700);
    font-weight: var(--font-weight-bold);
    margin-top: 0.2rem;
    padding: 0.7rem 0.65rem 0.55rem;
}

.finance-space-switcher--mobile-brand {
    max-width: min(17rem, calc(100vw - 5rem));
}

.finance-space-switcher--mobile-brand summary {
    gap: 0.55rem;
    justify-content: flex-start;
}

.finance-space-switcher--mobile-brand summary span {
    display: block;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.finance-space-switcher--mobile-brand .finance-space-switcher-menu {
    left: 0;
    right: auto;
}

.app-nav,
.app-bottom-nav {
    scrollbar-width: none;
}

.app-nav::-webkit-scrollbar,
.app-bottom-nav::-webkit-scrollbar {
    display: none;
}

.app-nav--sidebar {
    display: grid;
    gap: 0.25rem;
}

.app-nav-link,
.app-bottom-nav-link {
    align-items: center;
    color: #52615a;
    text-decoration: none;
    transition:
        background-color var(--transition-base),
        border-color var(--transition-base),
        color var(--transition-base);
}

.app-nav-link {
    border: 1px solid transparent;
    border-radius: 8px;
    display: flex;
    font-size: 0.92rem;
    font-weight: var(--font-weight-medium);
    gap: 0.6rem;
    min-height: 2.45rem;
    padding: 0.55rem 0.65rem;
}

.app-bottom-nav {
    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--color-border);
    bottom: 0;
    box-shadow: 0 -12px 30px rgba(20, 38, 32, 0.08);
    display: grid;
    gap: 0.12rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    left: 0;
    overflow: hidden;
    padding: 0.38rem 0.35rem max(0.45rem, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    width: 100vw;
    z-index: 30;
}

.app-bottom-nav-link {
    border-radius: 8px;
    display: grid;
    font-size: 0.6rem;
    font-weight: var(--font-weight-medium);
    gap: 0.18rem;
    justify-items: center;
    line-height: 1.1;
    min-height: 3.15rem;
    min-width: 0;
    padding: 0.4rem 0.05rem;
}

.app-nav-link:hover,
.app-nav-link:focus-visible,
.app-bottom-nav-link:hover,
.app-bottom-nav-link:focus-visible {
    background: #eef5ef;
    color: var(--color-brand-800);
}

.app-nav-link:focus-visible,
.app-bottom-nav-link:focus-visible,
.app-icon-button:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.app-nav-link.is-active,
.app-bottom-nav-link.is-active {
    color: var(--color-brand-800);
}

.app-nav-link.is-active {
    background: #e7f2ea;
    border-color: #cde0d3;
}

.app-bottom-nav-link.is-active {
    background: #edf6ef;
}

.app-nav-link svg,
.app-bottom-nav-link svg {
    height: 1rem;
    stroke-width: 2;
    width: 1rem;
}

body.app-body .app-main {
    margin: 0 auto;
    max-width: 34rem;
    min-width: 0;
    padding: 0.45rem 1rem calc(7.5rem + env(safe-area-inset-bottom));
}

.page-header {
    display: grid;
    gap: 0.55rem;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    color: var(--color-text-strong);
    font-size: 2rem;
    letter-spacing: 0;
    line-height: 1.12;
    margin: 0;
}

.page-header p {
    color: var(--color-text-muted);
    line-height: 1.55;
    margin: 0;
    max-width: 44rem;
}

.empty-state {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.empty-state {
    max-width: 42rem;
    padding: 1.25rem;
}

.empty-state-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 2.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    width: 2.5rem;
}

.empty-state-icon svg {
    height: 1.15rem;
    stroke-width: 2;
    width: 1.15rem;
}

.empty-state h2 {
    color: var(--color-text-strong);
    font-size: 1.15rem;
    letter-spacing: 0;
    line-height: 1.25;
    margin: 0 0 0.45rem;
}

.empty-state p {
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* =========================================================================
   3.5 Shared app UI
   ========================================================================= */
.app-screen {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.app-page-header {
    align-items: start;
    gap: 0.9rem;
}

.app-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
    min-width: 0;
    padding: 0.75rem;
}

.app-section-heading {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.app-section-heading h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.app-panel-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.35rem;
    justify-content: center;
    width: 2.35rem;
}

.app-panel-icon svg {
    height: 1.05rem;
    width: 1.05rem;
}

.app-primary-action,
.app-secondary-action,
.app-danger-action {
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: var(--font-weight-bold);
    gap: 0.36rem;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 0.72rem;
    text-decoration: none;
}

.app-primary-action {
    appearance: none;
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    color: var(--color-surface);
}

.app-primary-action:hover,
.app-primary-action:focus-visible {
    background: var(--color-brand-800);
    border-color: var(--color-brand-800);
    color: var(--color-surface);
}

.app-secondary-action {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.app-danger-action {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger);
}

.app-avatar {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    object-fit: cover;
    overflow: hidden;
}

.app-primary-action svg,
.app-secondary-action svg,
.app-danger-action svg {
    height: 0.95rem;
    width: 0.95rem;
}

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

.app-field label {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.app-field input,
.app-field select,
.app-field textarea {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    min-height: 2.5rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    width: 100%;
}

.app-field select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1rem) 50%,
        calc(100% - 0.72rem) 50%;
    background-repeat: no-repeat;
    background-size:
        0.28rem 0.28rem,
        0.28rem 0.28rem;
    padding-right: 2.25rem;
}

.app-field input:focus,
.app-field select:focus,
.app-field textarea:focus {
    border-color: var(--color-brand-700);
    box-shadow: var(--focus-ring);
    outline: none;
}

.app-field input[aria-invalid="true"],
.app-field select[aria-invalid="true"],
.app-field textarea[aria-invalid="true"] {
    border-color: var(--color-danger);
}

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

.app-dialog-actions {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.app-drawer-frame {
    background: var(--color-surface);
    box-shadow: -18px 0 48px rgba(20, 38, 32, 0.16);
    display: block;
    overflow-y: auto;
    pointer-events: none;
    position: fixed;
    transition:
        transform 0.28s ease,
        visibility 0.28s ease;
    visibility: hidden;
    z-index: 50;
}

.app-drawer-frame[complete] {
    pointer-events: auto;
    visibility: visible;
}

.app-drawer-panel {
    align-content: start;
    background: var(--color-surface);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 100%;
    padding: 1.15rem;
}

.app-drawer-header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.app-drawer-header h2 {
    color: var(--color-text-strong);
    font-size: 1.05rem;
    line-height: 1.2;
    margin: 0;
}

.app-drawer-header p {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0;
}

.app-drawer-header > div {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.app-icon-action {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 2rem;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    width: 2rem;
}

.app-icon-action svg {
    height: 1rem;
    width: 1rem;
}

.app-drawer-footer {
    align-self: end;
    display: grid;
    gap: 0.55rem;
    margin-top: auto;
    width: 100%;
}

.app-help-box {
    align-items: start;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: flex;
    gap: 0.55rem;
    line-height: 1.35;
    padding: 0.65rem;
}

.app-help-box > svg {
    flex: 0 0 auto;
    height: 1rem;
    margin-top: 0.1rem;
    width: 1rem;
}

.app-help-box strong {
    color: var(--color-brand-800);
    font-size: 0.82rem;
}

.app-help-box ul {
    display: grid;
    gap: 0.25rem;
    margin: 0.35rem 0 0;
    padding-left: 1rem;
}

.app-help-box li {
    font-size: 0.78rem;
}

/* =========================================================================
   3.6 Profile
   ========================================================================= */
.profile-hero-card {
    align-items: center;
    display: grid;
    gap: 0.8rem;
    grid-template-columns: auto minmax(0, 1fr);
}

.avatar.profile-avatar {
    height: 4.25rem;
    width: 4.25rem;
}

.profile-hero-copy {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.profile-hero-copy h2,
.profile-action-card h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}

.profile-hero-copy p,
.profile-action-card p {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0;
    overflow-wrap: anywhere;
}

.profile-avatar-trigger {
    border-radius: 999px;
    cursor: pointer;
    display: inline-block;
    position: relative;
}

.profile-avatar-trigger:focus-visible {
    outline: 2px solid var(--color-brand-700);
    outline-offset: 2px;
}

.profile-avatar-trigger-badge {
    align-items: center;
    background: var(--color-brand-700);
    border: 2px solid var(--color-surface);
    border-radius: 999px;
    bottom: -0.1rem;
    color: var(--color-surface);
    display: flex;
    height: 1.6rem;
    justify-content: center;
    position: absolute;
    right: -0.1rem;
    width: 1.6rem;
}

.profile-avatar-trigger-badge svg {
    height: 0.85rem;
    width: 0.85rem;
}

.profile-avatar-trigger:hover .profile-avatar-trigger-badge,
.profile-avatar-trigger:focus-visible .profile-avatar-trigger-badge {
    background: var(--color-brand-800);
}

.profile-detail-card {
    display: grid;
    gap: 0.75rem;
}

.profile-data-list {
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: grid;
    overflow: hidden;
}

.profile-data-row {
    align-items: center;
    background: var(--color-surface);
    display: flex;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.68rem;
}

.profile-data-row + .profile-data-row {
    border-top: 1px solid rgba(232, 223, 210, 0.95);
}

.profile-data-row span {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    grid-column: 1 / -1;
}

.profile-data-row strong {
    color: var(--color-text-strong);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.profile-field-value {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.profile-field-value small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.profile-field-edit {
    align-items: center;
    border-radius: 8px;
    color: var(--color-text-muted);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    text-decoration: none;
    width: 2rem;
}

.profile-field-edit:hover,
.profile-field-edit:focus-visible {
    background: #edf6ef;
    color: var(--color-brand-700);
}

.profile-field-edit svg {
    height: 0.95rem;
    width: 0.95rem;
}

.profile-data-row.is-editing {
    display: block;
}

.profile-inline-form {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.profile-inline-form .app-field {
    flex: 1 1 12rem;
}

.profile-inline-actions {
    display: flex;
    gap: 0.5rem;
}

.profile-inline-actions .app-primary-action,
.profile-inline-actions .app-secondary-action {
    min-height: 2.5rem;
}

.profile-action-card {
    align-items: center;
    display: grid;
    gap: 0.7rem;
    grid-template-columns: auto minmax(0, 1fr);
}

.profile-action-card .app-secondary-action,
.profile-action-card form {
    grid-column: 1 / -1;
    margin: 0;
}

.profile-action-card .app-danger-action {
    width: 100%;
}

.app-password-field {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
}

.app-password-field input {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-right: 2.9rem;
}

/* =========================================================================
   3.7 Avatars
   ========================================================================= */
.avatar {
    background: var(--color-surface);
    border-radius: 999px;
    display: block;
    height: 2.5rem;
    object-fit: cover;
    width: 2.5rem;
}

.avatar--preview {
    height: 6rem;
    width: 6rem;
}

.avatar--nav {
    height: 1.5rem;
    width: 1.5rem;
}

.avatar-picker-layout {
    display: grid;
    gap: 0.75rem;
}

.avatar-choices-field {
    border: 0;
    margin: 0;
    min-width: 0;
    padding: 0;
}

.avatar-choices-field legend {
    color: var(--color-text-strong);
    font-size: 0.82rem;
    font-weight: var(--font-weight-bold);
    margin-bottom: 0.5rem;
    padding: 0;
}

.avatar-choices {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(auto-fill, minmax(3.25rem, 1fr));
}

.avatar-choice {
    cursor: pointer;
    display: block;
}

.avatar-choice input {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.avatar-choice .avatar {
    border: 2px solid transparent;
    height: 100%;
    padding: 2px;
    width: 100%;
}

.avatar-choice input:checked + .avatar {
    border-color: var(--color-brand-700);
}

.avatar-choice input:focus-visible + .avatar {
    outline: 2px solid var(--color-brand-700);
    outline-offset: 2px;
}

.avatar-picker-upload,
.avatar-picker-preview {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.avatar-picker-upload h2,
.avatar-picker-preview h2 {
    color: var(--color-text-strong);
    font-size: 0.82rem;
    line-height: 1.2;
    margin: 0;
}

.avatar-upload-card,
.avatar-preview-card {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    justify-items: center;
    min-height: 7rem;
    padding: 0.85rem;
    text-align: center;
}

.avatar-upload-card {
    cursor: pointer;
    gap: 0.25rem;
}

.avatar-upload-card svg {
    color: var(--color-brand-700);
    height: 1.1rem;
    width: 1.1rem;
}

.avatar-upload-card span {
    color: var(--color-brand-700);
    font-size: 0.84rem;
    font-weight: var(--font-weight-bold);
}

.avatar-upload-card small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.avatar-upload-input {
    position: absolute;
    transform: translateX(-9999px);
}

.avatar-upload-card.is-active {
    border-color: var(--color-brand-700);
}

.avatar-preview-head {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    min-height: 1.5rem;
}

.avatar-change-badge {
    background: #edf6ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    font-size: 0.72rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
    padding: 0.18rem 0.5rem;
    white-space: nowrap;
}

.avatar-change-badge::before {
    background: currentColor;
    border-radius: 999px;
    content: "";
    display: inline-block;
    height: 0.4rem;
    margin-right: 0.3rem;
    vertical-align: middle;
    width: 0.4rem;
}

.app-primary-action:disabled {
    background: #dce5de;
    border-color: #dce5de;
    color: var(--color-text-muted);
    cursor: not-allowed;
}

@media (max-width: 767px) {
    .app-drawer-frame {
        border-radius: 14px 14px 0 0;
        bottom: 0;
        left: 0;
        max-height: min(82vh, 44rem);
        right: 0;
        transform: translateY(100%);
    }

    .app-drawer-frame[complete] {
        transform: translateY(0);
    }

    .app-drawer-frame.drawer-hide {
        transform: translateY(100%);
    }
}

@media (min-width: 768px) {
    .app-screen {
        gap: 1.1rem;
    }

    .app-page-header {
        display: flex;
        justify-content: space-between;
    }

    .app-panel {
        padding: 1rem;
    }

    .app-drawer-frame {
        bottom: 0;
        right: 0;
        top: 0;
        transform: translateX(100%);
        width: min(28rem, 42vw);
    }

    .app-drawer-frame[complete] {
        transform: translateX(0);
    }

    .app-drawer-frame.drawer-hide {
        transform: translateX(100%);
    }

    .app-drawer-footer {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .profile-hero-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .profile-data-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto;
    }

    .profile-data-row span {
        grid-column: auto;
    }

    .profile-action-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .profile-action-card .app-secondary-action,
    .profile-action-card form {
        grid-column: auto;
    }

    .avatar-picker-layout {
        grid-template-columns: minmax(0, 1fr) minmax(10rem, 0.72fr);
    }
}

/* =========================================================================
   4. Setup
   ========================================================================= */
.setup-screen {
    display: grid;
    gap: 1.35rem;
    min-width: 0;
}

.setup-header {
    display: grid;
    gap: 0.65rem;
}

.setup-header h1 {
    color: var(--color-text-strong);
    font-size: 2.35rem;
    letter-spacing: 0;
    line-height: 1.08;
    margin: 0;
}

.setup-stepper {
    align-items: center;
    color: var(--color-brand-700);
    display: flex;
    flex-wrap: wrap;
    gap: 0.72rem;
}

.setup-stepper strong {
    font-size: 0.98rem;
    line-height: 1.2;
}

.setup-step-dot {
    background: #d8e7dc;
    border-radius: 999px;
    display: inline-flex;
    height: 0.74rem;
    width: 0.74rem;
}

.setup-step-dot.is-active,
.setup-step-dot.is-complete {
    background: var(--color-brand-700);
}

.setup-card {
    background:
        linear-gradient(
            120deg,
            rgba(255, 255, 255, 0.98),
            rgba(248, 252, 247, 0.94)
        ),
        var(--color-surface);
    border: 1px solid rgba(205, 224, 211, 0.9);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(20, 38, 32, 0.08);
    display: grid;
    gap: 1.7rem;
    min-width: 0;
    overflow: hidden;
    padding: 1.35rem;
}

.setup-form-panel,
.setup-visual-panel,
.setup-form,
.setup-field,
.setup-actions {
    display: grid;
    min-width: 0;
}

.setup-form-panel {
    align-content: start;
    gap: 1.25rem;
}

.setup-intro {
    align-items: start;
    display: grid;
    gap: 1rem;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
}

.setup-intro-icon {
    align-items: center;
    background: #edf5ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 3.7rem;
    justify-content: center;
    width: 3.7rem;
}

.setup-intro-icon svg {
    height: 1.7rem;
    stroke-width: 2;
    width: 1.7rem;
}

.setup-intro h2 {
    color: var(--color-text-strong);
    font-size: 1.32rem;
    letter-spacing: 0;
    line-height: 1.18;
    margin: 0;
}

.setup-intro p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0.65rem 0 0;
}

.setup-form {
    gap: 1rem;
}

.setup-field {
    gap: 0.45rem;
}

.setup-field label {
    color: var(--color-text-strong);
    font-size: 0.86rem;
    line-height: 1.25;
}

.setup-field label span {
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.setup-field input,
.setup-field select {
    background: var(--color-surface);
    border: 1px solid #d5ddd8;
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    min-height: 3.25rem;
    outline: 0;
    padding: 0.85rem 1rem;
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base);
    width: 100%;
}

.setup-field select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1.15rem) 50%,
        calc(100% - 0.85rem) 50%;
    background-repeat: no-repeat;
    background-size:
        0.32rem 0.32rem,
        0.32rem 0.32rem;
    padding-right: 2.4rem;
}

.setup-field input::placeholder {
    color: var(--color-text-placeholder);
    opacity: 1;
}

.setup-field input:focus,
.setup-field select:focus {
    border-color: rgba(11, 116, 78, 0.68);
    box-shadow: 0 0 0 3px rgba(11, 116, 78, 0.12);
}

.setup-field input[aria-invalid="true"],
.setup-field select[aria-invalid="true"] {
    border-color: var(--color-danger-border);
}

.setup-primary-action,
.setup-secondary-action {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    justify-content: center;
    min-height: 3.3rem;
    text-decoration: none;
}

.setup-primary-action {
    background: linear-gradient(
        180deg,
        var(--color-brand-from),
        var(--color-brand-800)
    );
    border: 0;
    box-shadow: var(--shadow-button);
    color: #fff;
    cursor: pointer;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    transition:
        box-shadow var(--transition-base),
        transform var(--transition-base),
        background var(--transition-base);
    width: 100%;
}

.setup-primary-action:hover {
    background: linear-gradient(
        180deg,
        var(--color-brand-hover-from),
        var(--color-brand-hover-to)
    );
    box-shadow: var(--shadow-button-hover);
    color: #fff;
    transform: translateY(-1px);
}

.setup-primary-action:active {
    box-shadow: var(--shadow-button-active);
    transform: translateY(0);
}

.setup-primary-action svg {
    height: 1.3rem;
    stroke-width: 2.4;
    width: 1.3rem;
}

.setup-secondary-action {
    border: 1px solid rgba(205, 224, 211, 0.95);
    color: var(--color-brand-700);
    padding: 0.8rem 1rem;
}

.setup-secondary-action:hover {
    background: #edf6ef;
    color: var(--color-brand-800);
}

.setup-primary-action:focus-visible,
.setup-secondary-action:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.setup-actions {
    gap: 0.7rem;
}

.setup-inline-note {
    align-items: center;
    color: var(--color-text-muted);
    display: flex;
    font-size: 0.82rem;
    gap: 0.5rem;
    justify-content: center;
    line-height: 1.4;
    margin: 0;
    text-align: center;
}

.setup-inline-note svg {
    color: var(--color-brand-700);
    flex: 0 0 auto;
    height: 0.95rem;
    width: 0.95rem;
}

.setup-visual-panel {
    align-content: start;
    gap: 1.2rem;
}

.setup-house-illustration {
    display: block;
    filter: saturate(0.96);
    height: auto;
    justify-self: center;
    max-width: min(100%, 20rem);
    user-select: none;
}

.setup-benefits {
    display: grid;
    gap: 0.9rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.setup-benefits li {
    align-items: center;
    display: grid;
    gap: 0.8rem;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
}

.setup-benefits li > span {
    align-items: center;
    background: #edf5ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 2.55rem;
    justify-content: center;
    width: 2.55rem;
}

.setup-benefits svg {
    height: 1.15rem;
    width: 1.15rem;
}

.setup-benefits strong {
    color: var(--color-text-strong);
    display: block;
    font-size: 0.92rem;
    line-height: 1.25;
}

.setup-benefits p {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    line-height: 1.38;
    margin: 0.15rem 0 0;
}

.setup-privacy-note {
    align-items: center;
    color: var(--color-text-muted);
    display: grid;
    font-size: 0.9rem;
    gap: 0.2rem 0.7rem;
    grid-template-columns: auto minmax(0, 1fr);
    justify-content: center;
    justify-self: center;
    line-height: 1.4;
    margin: 0;
    max-width: 32rem;
    text-align: left;
}

.setup-privacy-note span {
    align-items: center;
    background: #edf5ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    display: inline-flex;
    grid-row: span 2;
    height: 2.8rem;
    justify-content: center;
    width: 2.8rem;
}

.setup-privacy-note svg {
    height: 1.25rem;
    width: 1.25rem;
}

.setup-privacy-note strong {
    color: var(--color-text-strong);
}

.setup-privacy-note small {
    font-size: 0.86rem;
}

/* =========================================================================
   5. Dashboard
   ========================================================================= */
.dashboard-screen {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.dashboard-hero {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    min-width: 0;
}

.dashboard-title {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.dashboard-title p,
.dashboard-title span,
.dashboard-kpi-label,
.dashboard-kpi-card small,
.dashboard-section-heading p {
    color: var(--color-text-muted);
}

.dashboard-title p {
    font-size: 0.86rem;
    font-weight: var(--font-weight-medium);
    margin: 0;
}

.dashboard-title span {
    font-size: 0.88rem;
    line-height: 1.35;
}

.dashboard-title h1 {
    color: var(--color-text-strong);
    font-size: 1.75rem;
    letter-spacing: 0;
    line-height: 1.1;
    margin: 0;
}

.dashboard-section-heading button {
    align-items: center;
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    display: inline-flex;
    gap: 0.35rem;
    font-weight: var(--font-weight-medium);
}

.dashboard-section-heading button svg {
    height: 0.95rem;
    width: 0.95rem;
}

.dashboard-kpi-card,
.dashboard-person-card,
.dashboard-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.07);
}

@property --gift-glow-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

/* Doubled class beats the later generic `.dashboard-panel` rule, which would
   otherwise force the card into a single-column grid with extra padding. */
.dashboard-panel.birthday-gift-card {
    align-items: stretch;
    background: #fdf9f0;
    display: flex;
    gap: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.birthday-gift-card::after {
    animation: gift-glow 4s linear infinite;
    background: conic-gradient(
        from var(--gift-glow-angle),
        transparent 0deg 290deg,
        rgba(212, 175, 55, 0.45) 330deg,
        #f3d98b 354deg,
        #fff7df 360deg
    );
    border-radius: inherit;
    content: "";
    inset: 0;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
    pointer-events: none;
    position: absolute;
}

/* Glowing head leading the golden trail: driven by the same animated angle as
   the trail, so both stay in sync; the thicker masked ring lets the head bulge
   past the 2px line and the blur turns it into a soft shooting-star glow. */
.birthday-gift-card::before {
    animation: gift-glow 4s linear infinite;
    background: conic-gradient(
        from var(--gift-glow-angle),
        transparent 0deg 352deg,
        rgba(255, 251, 232, 0.9) 356deg,
        #fffbe8 360deg
    );
    border-radius: inherit;
    content: "";
    filter: blur(1.5px);
    inset: 0;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 5px;
    pointer-events: none;
    position: absolute;
}

@keyframes gift-glow {
    to {
        --gift-glow-angle: 360deg;
    }
}

@media (prefers-reduced-motion: reduce) {
    .birthday-gift-card::before,
    .birthday-gift-card::after {
        animation: none;
    }
}

.birthday-gift-card-content {
    display: grid;
    flex: 1 1 55%;
    gap: 0.65rem;
    justify-items: start;
    padding: 1.15rem 0 1.15rem 1.15rem;
}

.birthday-gift-card-badge {
    align-items: center;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(11, 116, 78, 0.25);
    border-radius: 999px;
    color: var(--color-brand-700);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    gap: 0.4rem;
    padding: 0.32rem 0.7rem;
}

.birthday-gift-card-badge svg {
    height: 0.95rem;
    width: 0.95rem;
}

.birthday-gift-card h2 {
    color: var(--color-text-strong);
    font-size: 1.3rem;
    line-height: 1.25;
    margin: 0;
    text-wrap: balance;
    text-wrap: pretty;
}

.birthday-gift-card p {
    color: var(--color-text-muted);
    font-size: 0.88rem;
    line-height: 1.4;
    margin: 0;
}

.birthday-gift-card-button {
    align-items: center;
    background: var(--color-brand-700);
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    font-size: 0.92rem;
    font-weight: var(--font-weight-bold);
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding: 0.6rem 1.05rem;
    text-decoration: none;
}

.birthday-gift-card-button svg {
    height: 1rem;
    width: 1rem;
}

.birthday-gift-card-image {
    align-self: center;
    flex: 0 1 45%;
    height: auto;
    min-width: 0;
    object-fit: contain;
    width: 45%;
}

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

.dashboard-kpi-card {
    align-content: center;
    align-items: center;
    display: grid;
    gap: 0.15rem 0.7rem;
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 5.25rem;
    padding: 0.8rem;
    position: relative;
}

.dashboard-kpi-card--primary {
    grid-column: 1 / -1;
    min-height: 6.25rem;
}

.dashboard-kpi-card:nth-child(4) {
    grid-column: 1 / -1;
}

.dashboard-kpi-card--desktop {
    display: none;
}

.dashboard-kpi-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    display: inline-flex;
    grid-row: 1 / span 3;
    height: 2.1rem;
    justify-content: center;
    width: 2.1rem;
}

.dashboard-kpi-icon svg {
    height: 1rem;
    width: 1rem;
}

.dashboard-kpi-card--surplus.is-negative .dashboard-kpi-icon {
    background: #ffe9e6;
    color: var(--color-danger);
}

.dashboard-kpi-label {
    color: var(--color-text-strong);
    font-size: 0.72rem;
    font-weight: var(--font-weight-medium);
    line-height: 1.25;
}

.dashboard-kpi-card strong {
    color: var(--color-text-strong);
    font-size: 1.15rem;
    letter-spacing: 0;
    line-height: 1.08;
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-kpi-card--primary strong {
    font-size: 1.85rem;
}

.dashboard-kpi-card small {
    font-size: 0.7rem;
    line-height: 1.2;
}

.dashboard-section,
.dashboard-grid,
.dashboard-secondary-grid {
    display: grid;
    gap: 0.75rem;
}

.dashboard-section-heading {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.dashboard-section-heading > div {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.dashboard-section-heading h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.dashboard-section-heading p {
    font-size: 0.75rem;
    margin: 0;
}

.dashboard-section-heading a {
    align-items: center;
    color: var(--color-brand-700);
    display: inline-flex;
    font-size: 0.82rem;
    font-weight: var(--font-weight-medium);
    gap: 0.3rem;
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-section-heading a svg {
    height: 0.95rem;
    width: 0.95rem;
}

.dashboard-section-heading button,
.dashboard-history-range {
    font-size: 0.76rem;
    min-height: 2rem;
    padding: 0 0.55rem;
}

.dashboard-history-range {
    align-items: center;
    background: #fbfaf7;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    white-space: nowrap;
}

.dashboard-section-meta {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    font-weight: var(--font-weight-medium);
}

.dashboard-primary-grid,
.dashboard-person-list,
.dashboard-action-list {
    display: grid;
    gap: 0.65rem;
}

.dashboard-person-panel {
    order: 2;
}

.dashboard-chart-panel {
    order: 1;
}

.dashboard-person-card {
    color: var(--color-text);
    display: grid;
    gap: 0.38rem 0.75rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 4.6rem;
    min-width: 0;
    padding: 0.75rem;
    text-decoration: none;
}

.dashboard-person-card:hover,
.dashboard-person-card:focus-visible,
.dashboard-action-row:hover,
.dashboard-action-row:focus-visible {
    border-color: #cde0d3;
    color: var(--color-text);
}

.dashboard-person-card:focus-visible,
.dashboard-action-row:focus-visible,
.dashboard-section-heading button:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.dashboard-person-main {
    display: grid;
    gap: 0.3rem;
    min-width: 0;
}

.dashboard-person-card strong {
    color: var(--color-text-strong);
    font-size: 0.86rem;
    line-height: 1.2;
}

.dashboard-person-card b {
    color: var(--color-text-strong);
    font-size: 1rem;
    white-space: nowrap;
}

.dashboard-avatar {
    background: var(--color-brand-700);
    color: var(--color-surface);
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    height: 2.8rem;
    width: 2.8rem;
}

.dashboard-avatar--blue {
    background: #72a77e;
    color: var(--color-surface);
}

.dashboard-person-share {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: var(--font-weight-medium);
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
}

.dashboard-person-track {
    background: #dceee0;
    border-radius: 999px;
    display: block;
    grid-column: 2 / -1;
    height: 0.34rem;
    overflow: hidden;
}

.dashboard-person-track span {
    background: var(--color-brand-700);
    border-radius: 999px;
    display: block;
    height: 100%;
    min-width: 0.35rem;
}

.dashboard-panel {
    display: grid;
    gap: 0.9rem;
    padding: 0.9rem;
    align-content: start;
}

.dashboard-chart {
    display: block;
    height: auto;
    width: 100%;
}

.dashboard-chart line {
    stroke: #e8dfd2;
    stroke-width: 1;
}

.dashboard-chart .dashboard-chart-area {
    fill: url("#dashboard-chart-fill");
    stroke: none;
}

.dashboard-chart path {
    fill: none;
    stroke: var(--color-brand-700);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5;
}

.dashboard-chart circle {
    fill: var(--color-brand-700);
}

.dashboard-chart text {
    fill: var(--color-text-muted);
    font-size: 0.74rem;
    text-anchor: middle;
}

.dashboard-chart-summary {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
}

.dashboard-chart-summary span {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.55rem 0.65rem;
}

.dashboard-chart-summary span + span {
    border-left: 1px solid var(--color-border);
}

.dashboard-chart-summary small,
.dashboard-history-list-heading {
    color: var(--color-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dashboard-chart-summary b {
    color: var(--color-text-strong);
    font-size: 0.78rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-history-list {
    display: grid;
    gap: 0.5rem;
}

.dashboard-history-list-heading {
    align-items: center;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 0.15rem;
}

.dashboard-history-list-heading span:last-child {
    text-align: right;
}

.dashboard-history-row {
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    gap: 0.55rem;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 3.8rem;
    padding: 0.65rem 0.75rem;
}

.dashboard-history-row.is-primary {
    background: #f4fbf5;
    border-color: #cfe4d4;
}

.dashboard-history-row > span:first-child {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.dashboard-history-row strong {
    color: var(--color-text-strong);
    font-size: 0.86rem;
    line-height: 1.2;
}

.dashboard-history-row b {
    color: var(--color-text-strong);
    font-size: 0.96rem;
    white-space: nowrap;
}

.dashboard-history-delta {
    align-items: center;
    display: grid;
    gap: 0.08rem 0.3rem;
    grid-template-columns: auto auto;
    justify-content: end;
    text-align: right;
}

.dashboard-history-delta svg {
    grid-row: span 2;
    height: 0.95rem;
    width: 0.95rem;
}

.dashboard-history-delta small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    grid-column: 2;
    white-space: nowrap;
}

.dashboard-history-delta.is-positive,
.dashboard-history-delta.is-positive b {
    color: var(--color-brand-700);
}

.dashboard-history-delta.is-negative,
.dashboard-history-delta.is-negative b {
    color: #b42318;
}

.dashboard-history-delta.is-neutral,
.dashboard-history-delta.is-neutral b {
    color: var(--color-text-muted);
}

.dashboard-action-row {
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    display: grid;
    gap: 0.7rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 3.35rem;
    padding: 0.65rem;
    text-decoration: none;
}

.dashboard-action-row span {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.dashboard-action-row strong {
    color: var(--color-text-strong);
    font-size: 0.92rem;
}

.dashboard-action-row svg {
    height: 1rem;
    width: 1rem;
}

.dashboard-cashflow-panel,
.dashboard-special-payment-summary,
.dashboard-next-action-card {
    align-content: start;
}

.dashboard-empty-row {
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    display: grid;
    gap: 0.7rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 3.35rem;
    padding: 0.65rem;
    text-decoration: none;
}

.dashboard-empty-row:hover,
.dashboard-empty-row:focus-visible {
    border-color: #cde0d3;
    color: var(--color-text);
}

.dashboard-empty-row:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.dashboard-empty-row span {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.dashboard-empty-row strong {
    color: var(--color-text-strong);
    font-size: 0.92rem;
}

.dashboard-empty-row svg {
    height: 1rem;
    width: 1rem;
}

.dashboard-cashflow-summary {
    display: grid;
    gap: 0.7rem;
}

.dashboard-cashflow-summary span {
    align-items: center;
    display: grid;
    gap: 0.12rem 0.65rem;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
}

.dashboard-cashflow-summary i,
.dashboard-special-payment-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    font-style: normal;
    grid-row: 1 / span 2;
    height: 2.1rem;
    justify-content: center;
    width: 2.1rem;
}

.dashboard-cashflow-summary i svg,
.dashboard-special-payment-icon svg {
    height: 1rem;
    width: 1rem;
}

.dashboard-cashflow-summary small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
}

.dashboard-cashflow-summary b {
    color: var(--color-text-strong);
    font-size: 1rem;
    white-space: nowrap;
}

.dashboard-cashflow-comparison {
    display: grid;
    gap: 0.55rem;
}

.dashboard-cashflow-summary + .dashboard-cashflow-comparison {
    margin-top: 0.85rem;
}

.dashboard-inline-action {
    align-items: center;
    color: var(--color-brand-700);
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: var(--font-weight-bold);
    gap: 0.4rem;
    justify-self: end;
    text-decoration: none;
}

.dashboard-inline-action svg {
    height: 1rem;
    width: 1rem;
}

.dashboard-special-payment-compact {
    align-items: center;
    display: flex;
    gap: 0.9rem;
    min-height: 3.7rem;
}

.dashboard-special-payment-compact strong {
    color: var(--color-text-strong);
    font-size: 1.45rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

/* =========================================================================
   6. Finance spaces
   ========================================================================= */
.finance-space-index-screen {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.finance-space-index-header {
    align-items: start;
    gap: 1rem;
}

.finance-space-primary-link {
    align-items: center;
    background: var(--color-brand-700);
    border-radius: 8px;
    color: var(--color-surface);
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    gap: 0.45rem;
    min-height: 2.85rem;
    padding: 0.75rem 0.9rem;
    text-decoration: none;
}

.finance-space-primary-link:hover {
    background: var(--color-brand-800);
    color: var(--color-surface);
}

.finance-space-primary-link:focus-visible,
.finance-space-card:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.finance-space-primary-link svg {
    height: 1.05rem;
    width: 1.05rem;
}

.finance-space-grid {
    display: grid;
    gap: 0.75rem;
}

.finance-space-card {
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
    color: var(--color-text);
    display: grid;
    gap: 0.75rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 5rem;
    min-width: 0;
    padding: 0.85rem;
    text-decoration: none;
}

.finance-space-card:hover {
    border-color: #cde0d3;
    color: var(--color-text);
}

.finance-space-card-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    height: 2.55rem;
    justify-content: center;
    width: 2.55rem;
}

.finance-space-card-icon svg,
.finance-space-card > svg {
    height: 1.05rem;
    width: 1.05rem;
}

.finance-space-card-body {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.finance-space-card-body strong {
    color: var(--color-text-strong);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.finance-space-card-body small {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.finance-space-card-role {
    background: #edf6ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    font-size: 0.72rem;
    font-weight: var(--font-weight-bold);
    padding: 0.3rem 0.55rem;
}

.finance-space-card > svg {
    color: var(--color-text-muted);
    display: none;
}

/* =========================================================================
   7. People management
   ========================================================================= */
.people-screen {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.people-header {
    align-items: start;
    gap: 1rem;
}

.people-back-link {
    align-items: center;
    color: var(--color-brand-700);
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    gap: 0.4rem;
    text-decoration: none;
}

.people-back-link svg {
    height: 1rem;
    width: 1rem;
}

.people-error,
.people-panel {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
}

.people-error {
    align-items: center;
    color: var(--color-danger);
    display: flex;
    gap: 0.65rem;
    padding: 0.85rem;
}

.people-error svg {
    flex: 0 0 auto;
    height: 1.05rem;
    width: 1.05rem;
}

.people-error p {
    margin: 0;
}

.people-panel {
    display: grid;
    gap: 0.9rem;
    padding: 0.9rem;
}

.people-section-heading,
.people-card-main,
.people-inline-controls,
.people-card-actions,
.people-own-note,
.people-empty-state {
    align-items: center;
    display: flex;
}

.people-section-heading {
    gap: 0.75rem;
    justify-content: space-between;
}

.people-section-heading h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.people-section-heading > span {
    background: #edf6ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    min-width: 1.65rem;
    padding: 0.25rem 0.5rem;
    text-align: center;
}

.people-list {
    display: grid;
    gap: 0.75rem;
}

.people-invitation-list {
    display: grid;
    gap: 0.65rem;
}

.people-invitation-card {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-width: 0;
    padding: 0.8rem;
}

.people-invitation-main,
.people-invitation-actions {
    align-items: center;
    display: flex;
}

.people-invitation-main {
    gap: 0.7rem;
    min-width: 0;
}

.people-invitation-main > div {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.people-invitation-main strong {
    color: var(--color-text-strong);
    overflow-wrap: anywhere;
}

.people-invitation-main small {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.people-invitation-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.15rem;
    justify-content: center;
    width: 2.15rem;
}

.people-invitation-icon svg {
    height: 1rem;
    width: 1rem;
}

.people-invitation-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.people-invitation-actions form {
    margin: 0;
}

.people-invitation-action {
    align-items: center;
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: var(--font-weight-bold);
    gap: 0.32rem;
    min-height: 2.25rem;
    padding: 0 0.6rem;
}

.people-invitation-action.is-danger {
    color: var(--color-danger);
}

.people-invitation-action svg {
    height: 0.85rem;
    width: 0.85rem;
}

.people-card {
    background: var(--color-surface);
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: grid;
    gap: 0.7rem;
    min-width: 0;
    padding: 0.85rem;
}

.people-card.is-inactive {
    background: rgba(255, 255, 255, 0.68);
}

.people-card-main {
    gap: 0.75rem;
    min-width: 0;
}

.people-card-main > div {
    display: grid;
    flex: 1 1 auto;
    gap: 0.12rem;
    min-width: 0;
}

.people-card-title-row {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    min-width: 0;
}

.people-card-main strong {
    color: var(--color-text-strong);
    flex: 0 1 auto;
    line-height: 1.2;
    min-width: 0;
}

.people-card-main small {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.people-avatar {
    background: #edf6ef;
    color: var(--color-brand-700);
    font-size: 0.92rem;
    font-weight: var(--font-weight-bold);
    height: 2.35rem;
    text-transform: uppercase;
    width: 2.35rem;
}

.people-avatar svg {
    height: 1.05rem;
    width: 1.05rem;
}

.people-status {
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: var(--font-weight-bold);
    padding: 0.3rem 0.55rem;
}

.person-editor-status-row .people-status {
    margin-left: initial;
}

.people-status.is-active {
    background: #e5f4e8;
    color: var(--color-brand-700);
}

.people-status.is-inactive {
    background: #f1eee9;
    color: var(--color-text-muted);
}

.people-status.is-own,
.people-status.is-linked {
    background: #edf6ef;
    color: var(--color-brand-700);
}

.people-card-badges {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 0.32rem;
    min-width: 0;
}

.people-rename-form {
    display: grid;
    gap: 0.4rem;
}

.people-rename-form label {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.people-inline-controls {
    gap: 0.55rem;
}

.people-inline-controls input {
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    min-height: 2.5rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    width: 100%;
}

.people-inline-controls input:focus {
    border-color: var(--color-brand-700);
    box-shadow: var(--focus-ring);
    outline: none;
}

.people-inline-controls input[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.people-inline-controls button,
.people-secondary-button {
    align-items: center;
    appearance: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    gap: 0.38rem;
    min-height: 2.5rem;
}

.people-inline-controls button {
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    color: var(--color-surface);
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 0.72rem;
}

.people-inline-controls button svg,
.people-secondary-button svg,
.people-own-note svg {
    height: 0.95rem;
    width: 0.95rem;
}

.people-card-actions {
    gap: 0.65rem;
    justify-content: space-between;
}

.people-card-actions form {
    margin: 0;
}

.people-card-meta {
    align-items: center;
    color: var(--color-text-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.78rem;
    gap: 0.35rem 0.7rem;
    line-height: 1.3;
}

.people-card-meta span,
.people-edit-link {
    align-items: center;
    display: inline-flex;
    gap: 0.3rem;
}

.people-card-meta svg {
    height: 0.82rem;
    width: 0.82rem;
}

.people-edit-link {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: var(--font-weight-bold);
    min-height: 2.35rem;
    padding: 0 0.72rem;
    text-decoration: none;
}

.people-edit-link svg {
    height: 0.9rem;
    width: 0.9rem;
}

.people-edit-link:focus-visible,
.people-invitation-action:focus-visible,
.person-editor-close:focus-visible,
.person-editor-icon-action:focus-visible,
.person-editor-primary:focus-visible,
.person-editor-secondary:focus-visible,
.person-editor-danger-button:focus-visible {
    box-shadow: var(--focus-ring);
    outline: none;
}

.people-secondary-button {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0 0.75rem;
}

.people-own-note {
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    font-size: 0.84rem;
    font-weight: var(--font-weight-medium);
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0 0.75rem;
}

.people-empty-state {
    background: #fbfaf7;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    gap: 0.65rem;
    min-height: 3.5rem;
    padding: 0.8rem;
}

.people-empty-state span {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.people-empty-state svg {
    height: 1rem;
    width: 1rem;
}

.people-empty-state p {
    margin: 0;
}

.person-editor-frame {
    background: var(--color-surface);
    box-shadow: 0 18px 45px rgba(20, 38, 32, 0.18);
    overflow: auto;
    pointer-events: none;
    position: fixed;
    transition:
        transform 0.28s ease,
        visibility 0.28s ease;
    visibility: hidden;
    z-index: 50;
}

.person-editor-frame[complete] {
    pointer-events: auto;
    visibility: visible;
}

.person-editor-frame .person-editor-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-height: 100%;
}

.person-editor-page {
    margin-inline: auto;
    max-width: 36rem;
}

.person-editor-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
    color: var(--color-text);
    align-content: start;
    display: grid;
    gap: 0.82rem;
    padding: 1.45rem 1.15rem 0.95rem;
}

.person-editor-header,
.person-editor-status-row,
.person-editor-actions,
.person-editor-inline,
.person-editor-login-state,
.person-editor-login-state > span,
.person-editor-assignment-list span,
.person-editor-note,
.person-editor-danger {
    align-items: center;
    display: flex;
}

.person-editor-header {
    justify-content: space-between;
}

.person-editor-header h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.person-editor-close {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.25rem;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    width: 2.25rem;
}

.person-editor-close svg,
.person-editor-icon-action svg,
.person-editor-primary svg,
.person-editor-danger-button svg,
.person-editor-note svg,
.person-editor-login-state svg,
.person-editor-assignment-list svg {
    height: 0.95rem;
    width: 0.95rem;
}

.person-editor-form,
.person-editor-section {
    display: grid;
    gap: 0.55rem;
}

.person-editor-form label,
.person-editor-section h3 {
    color: var(--color-text-muted);
    font-size: 0.74rem;
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.person-editor-form input,
.person-editor-form select {
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    font-size: 0.94rem;
    min-height: 2.28rem;
    min-width: 0;
    padding: 0.52rem 0.68rem;
    width: 100%;
}

.person-editor-form input:focus,
.person-editor-form select:focus {
    border-color: var(--color-brand-700);
    box-shadow: var(--focus-ring);
    outline: none;
}

.person-editor-form input[aria-invalid="true"],
.person-editor-form select[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.invitation-summary {
    display: grid;
    gap: 0.55rem;
    margin: 1rem 0;
}

.invitation-summary div {
    border-bottom: 1px solid var(--color-border);
    display: grid;
    gap: 0.2rem;
    padding-bottom: 0.55rem;
}

.invitation-summary dt {
    color: var(--color-text-muted);
    font-size: 0.76rem;
    font-weight: var(--font-weight-bold);
}

.invitation-summary dd {
    color: var(--color-text-strong);
    margin: 0;
    overflow-wrap: anywhere;
}

.person-editor-status-row,
.person-editor-actions,
.person-editor-inline {
    flex-wrap: wrap;
    gap: 0.45rem;
}

.person-editor-status-row {
    justify-content: flex-start;
}

.person-editor-inline input {
    flex: 1 1 12rem;
}

.person-editor-primary,
.person-editor-secondary,
.person-editor-danger-button {
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.9rem;
    font-weight: var(--font-weight-bold);
    gap: 0.38rem;
    justify-content: center;
    min-height: 2.28rem;
    padding: 0 0.68rem;
    text-decoration: none;
}

.person-editor-primary {
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    color: var(--color-surface);
}

.person-editor-secondary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.person-editor-login-state,
.person-editor-note {
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    font-size: 0.9rem;
    gap: 0.45rem;
    min-height: 2.28rem;
    padding: 0.55rem 0.65rem;
}

.person-editor-login-state {
    justify-content: space-between;
}

.person-editor-login-state > span {
    gap: 0.45rem;
}

.person-editor-login-state form {
    margin: 0;
}

.person-editor-icon-action {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--color-danger);
    cursor: pointer;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    padding: 0;
    width: 2rem;
}

.person-editor-assignment-list {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    gap: 0.45rem;
    padding: 0.62rem 0.68rem;
}

.person-editor-assignment-list span {
    color: var(--color-text);
    font-size: 0.92rem;
    gap: 0.45rem;
}

.person-editor-note {
    font-size: 0.8rem;
    line-height: 1.35;
    margin: 0;
}

.person-editor-footer {
    align-self: end;
    display: grid;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.25rem;
}

.person-editor-footer .person-editor-actions {
    justify-content: stretch;
}

.person-editor-footer .person-editor-primary,
.person-editor-footer .person-editor-secondary {
    flex: 1 1 0;
}

.person-editor-danger {
    justify-content: center;
}

.person-editor-danger form,
.person-editor-membership-remove {
    margin: 0;
}

.person-editor-membership-remove {
    display: flex;
    justify-content: center;
}

.person-editor-danger-button {
    background: transparent;
    border: 0;
    color: var(--color-danger);
    font-size: 0.86rem;
    min-height: 2rem;
}

.person-editor-own-note {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    margin: 0;
    text-align: center;
}

@media (max-width: 767px) {
    .people-invitation-card {
        align-items: stretch;
        flex-direction: column;
    }

    .people-invitation-actions {
        justify-content: stretch;
    }

    .people-invitation-actions form,
    .people-invitation-action {
        flex: 1 1 0;
    }

    .people-invitation-action {
        width: 100%;
    }

    .person-editor-frame {
        border-radius: 14px 14px 0 0;
        bottom: 0;
        left: 0;
        max-height: min(82vh, 44rem);
        right: 0;
        transform: translateY(100%);
    }

    .person-editor-frame[complete] {
        transform: translateY(0);
    }

    .person-editor-frame.drawer-hide {
        transform: translateY(100%);
    }
}

@media (min-width: 768px) {
    .person-editor-frame {
        bottom: 0;
        right: 0;
        top: 0;
        transform: translateX(100%);
        width: min(28rem, 42vw);
    }

    .person-editor-frame[complete] {
        transform: translateX(0);
    }

    .person-editor-frame.drawer-hide {
        transform: translateX(100%);
    }
}

/* =========================================================================
   8. Wealth management
   ========================================================================= */
.read-screen {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.read-header {
    align-items: start;
    gap: 0.9rem;
}

.read-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.read-header-link {
    align-items: center;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.9rem;
    font-weight: var(--font-weight-medium);
    gap: 0.4rem;
    text-decoration: none;
}

.read-header-link svg {
    height: 1rem;
    width: 1rem;
}

.wealth-primary-action,
.wealth-secondary-action,
.wealth-secondary-link,
.wealth-account-action {
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: var(--font-weight-bold);
    gap: 0.36rem;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0 0.72rem;
    text-decoration: none;
}

.wealth-primary-action {
    appearance: none;
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    color: var(--color-surface);
}

.wealth-primary-action:hover,
.wealth-primary-action:focus-visible {
    background: var(--color-brand-800);
    border-color: var(--color-brand-800);
    color: var(--color-surface);
}

.wealth-primary-action:disabled {
    background: #dce5de;
    border-color: #dce5de;
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.wealth-secondary-action,
.wealth-secondary-link {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.wealth-secondary-link svg,
.wealth-primary-action svg {
    height: 0.95rem;
    width: 0.95rem;
}

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

.wealth-summary-card {
    align-items: start;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(20, 38, 32, 0.05);
    display: flex;
    gap: 0.65rem;
    min-height: 6.1rem;
    min-width: 0;
    padding: 0.75rem;
}

.wealth-summary-card.is-primary {
    grid-column: 1 / -1;
}

.wealth-summary-icon {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2.05rem;
    justify-content: center;
    width: 2.05rem;
}

.wealth-summary-icon svg {
    height: 1rem;
    width: 1rem;
}

.wealth-summary-card div {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
}

.wealth-summary-card p,
.wealth-summary-card small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    line-height: 1.2;
    margin: 0;
}

.wealth-summary-card strong {
    color: var(--color-text-strong);
    font-size: 1.08rem;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.wealth-summary-card.is-primary strong {
    font-size: 1.42rem;
}

.wealth-filter-bar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: space-between;
    margin: 0 0 0.65rem;
}

.wealth-filter-chip-group,
.wealth-segmented-control {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.wealth-filter-chip,
.wealth-segment {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    min-height: 2rem;
    padding: 0 0.68rem;
    text-decoration: none;
    white-space: nowrap;
}

.wealth-filter-chip.is-active,
.wealth-segment.is-active {
    background: var(--color-brand-700);
    border-color: var(--color-brand-700);
    color: var(--color-surface);
}

.wealth-category-panel,
.wealth-account-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
    display: grid;
    gap: 0.85rem;
    min-width: 0;
    padding: 0.75rem;
}

.wealth-panel-heading,
.wealth-section-heading,
.wealth-inline-controls,
.wealth-empty-state {
    align-items: center;
    display: flex;
}

.wealth-panel-heading {
    gap: 0.75rem;
}

.wealth-panel-heading > div {
    min-width: 0;
}

.wealth-panel-heading h2,
.wealth-section-heading h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.wealth-panel-icon,
.wealth-category-icon,
.wealth-empty-state span {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
}

.wealth-panel-icon,
.wealth-category-icon {
    height: 2.35rem;
    width: 2.35rem;
}

.wealth-panel-icon svg,
.wealth-category-icon svg {
    height: 1.05rem;
    width: 1.05rem;
}

.wealth-category-form {
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

.wealth-category-form label,
.wealth-field label {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.wealth-form-grid {
    display: grid;
    gap: 0.72rem;
    min-width: 0;
}

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

.wealth-inline-controls {
    gap: 0.55rem;
    min-width: 0;
}

.wealth-balance-controls {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
}

.wealth-inline-controls input,
.wealth-field input,
.wealth-field select,
.wealth-field textarea {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    min-height: 2.5rem;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    width: 100%;
}

.wealth-field textarea {
    min-height: 5.5rem;
    resize: vertical;
}

.wealth-field select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 1rem) 50%,
        calc(100% - 0.72rem) 50%;
    background-repeat: no-repeat;
    background-size:
        0.28rem 0.28rem,
        0.28rem 0.28rem;
    padding-right: 2.25rem;
}

.wealth-inline-controls input:focus,
.wealth-field input:focus,
.wealth-field select:focus,
.wealth-field textarea:focus {
    border-color: var(--color-brand-700);
    box-shadow: var(--focus-ring);
    outline: none;
}

.wealth-inline-controls input[aria-invalid="true"],
.wealth-field input[aria-invalid="true"],
.wealth-field select[aria-invalid="true"],
.wealth-field textarea[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.wealth-inline-controls button {
    align-items: center;
    appearance: none;
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    border-radius: 8px;
    color: var(--color-surface);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: var(--font-weight-bold);
    gap: 0.38rem;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0 0.72rem;
}

.wealth-inline-controls button svg {
    height: 0.95rem;
    width: 0.95rem;
}

.wealth-section-heading {
    gap: 0.75rem;
    justify-content: space-between;
}

.wealth-section-heading strong {
    color: var(--color-text-strong);
    font-size: 0.95rem;
    white-space: nowrap;
}

.wealth-section-heading > span {
    background: #edf6ef;
    border-radius: 999px;
    color: var(--color-brand-700);
    font-size: 0.78rem;
    font-weight: var(--font-weight-bold);
    min-width: 1.65rem;
    padding: 0.25rem 0.5rem;
    text-align: center;
}

.wealth-category-list,
.wealth-account-list {
    display: grid;
    gap: 0.85rem;
}

/* Category list rows with inline Turbo edit. */
.wealth-category-row {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-width: 0;
    padding: 0.6rem 0.7rem;
}

.wealth-category-row-name {
    color: var(--color-text-strong);
    flex: 1 1 auto;
    font-weight: var(--font-weight-bold);
    min-width: 0;
    overflow-wrap: anywhere;
}

.wealth-category-edit {
    align-items: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: var(--font-weight-bold);
    gap: 0.35rem;
    margin-left: auto;
    min-height: 2.2rem;
    padding: 0 0.6rem;
    text-decoration: none;
}

.wealth-category-edit:hover,
.wealth-category-edit:focus-visible {
    background: #edf6ef;
    border-color: var(--color-brand-700);
    color: var(--color-brand-700);
}

.wealth-category-row-form {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    min-width: 0;
    width: 100%;
}

.wealth-category-row-input {
    appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    box-shadow: var(--shadow-input-inset);
    color: var(--color-text);
    flex: 1 1 0;
    min-height: 2.4rem;
    min-width: 0;
    padding: 0.5rem 0.7rem;
}

.wealth-category-row-input:focus {
    border-color: var(--color-brand-700);
    box-shadow: var(--focus-ring);
    outline: none;
}

.wealth-category-row-input[aria-invalid="true"] {
    border-color: var(--color-danger);
}

.wealth-category-row-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.35rem;
}

.wealth-category-action {
    align-items: center;
    appearance: none;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.84rem;
    font-weight: var(--font-weight-bold);
    gap: 0.35rem;
    justify-content: center;
    min-height: 2.4rem;
    padding: 0 0.65rem;
    text-decoration: none;
}

.wealth-category-action.is-accept {
    background: var(--color-brand-700);
    border: 1px solid var(--color-brand-700);
    color: var(--color-surface);
}

.wealth-category-action.is-accept:hover,
.wealth-category-action.is-accept:focus-visible {
    background: var(--color-brand-800);
    border-color: var(--color-brand-800);
}

.wealth-category-action.is-cancel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.wealth-category-action.is-cancel:hover,
.wealth-category-action.is-cancel:focus-visible {
    background: #f4f1ec;
}

.wealth-category-edit svg,
.wealth-category-action svg {
    height: 0.95rem;
    width: 0.95rem;
}

/* Mobile: action labels collapse to icon-only; shown again on desktop. */
.wealth-category-edit span,
.wealth-category-action span {
    display: none;
}

.wealth-category-row-error {
    flex: 1 0 100%;
}

.wealth-account-section {
    background: #fbfaf7;
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: grid;
    gap: 0.68rem;
    min-width: 0;
    padding: 0.7rem;
}

.wealth-account-section-heading,
.wealth-account-subsection-heading {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
}

.wealth-account-section-heading h3,
.wealth-account-subsection-heading h4 {
    color: var(--color-text-strong);
    font-size: 0.95rem;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0;
}

.wealth-account-section-heading strong {
    color: var(--color-text-strong);
    font-size: 0.9rem;
    white-space: nowrap;
}

.wealth-account-subsection {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.wealth-account-subsection-heading h4 {
    color: var(--color-text-muted);
    font-size: 0.74rem;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
}

.wealth-account-row-list {
    border: 1px solid rgba(232, 223, 210, 0.95);
    border-radius: 8px;
    display: grid;
    overflow: visible;
}

.wealth-account-row {
    align-items: center;
    background: var(--color-surface);
    display: grid;
    gap: 0.7rem;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    padding: 0.68rem;
}

.wealth-account-row + .wealth-account-row {
    border-top: 1px solid rgba(232, 223, 210, 0.95);
}

.wealth-account-main,
.wealth-balance-summary {
    align-items: center;
    display: flex;
    gap: 0.62rem;
    min-width: 0;
}

.wealth-account-main > div,
.wealth-balance-summary > div {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.wealth-account-main strong,
.wealth-balance-summary strong {
    color: var(--color-text-strong);
    font-size: 0.9rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.wealth-account-main small,
.wealth-balance-summary small {
    color: var(--color-text-muted);
    font-size: 0.72rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.wealth-account-icon {
    align-items: center;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: inline-flex;
    flex: 0 0 auto;
    height: 2rem;
    justify-content: center;
    width: 2rem;
}

.wealth-account-icon svg {
    height: 1rem;
    width: 1rem;
}

.wealth-account-icon.is-cash {
    background: #e8f2ff;
    color: #1760a8;
}

.wealth-account-icon.is-investment {
    background: #efeaf8;
    color: #5e3a9b;
}

.wealth-account-icon.is-crypto {
    background: #fff1db;
    color: #ba5d00;
}

.wealth-account-icon.is-default {
    background: #edf6ef;
    color: var(--color-brand-700);
}

.wealth-account-amount {
    color: var(--color-text-strong);
    font-size: 0.92rem;
    justify-self: start;
    white-space: nowrap;
}

.wealth-account-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: start;
}

.wealth-account-action {
    background: transparent;
    border: 0;
    color: var(--color-text);
    min-height: 2rem;
    padding: 0 0.45rem;
}

.wealth-account-action.is-balance {
    color: var(--color-brand-700);
}

.wealth-account-action--desktop {
    display: none;
}

.wealth-account-menu {
    position: relative;
}

.wealth-account-menu summary {
    align-items: center;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    list-style: none;
    width: 2rem;
}

.wealth-account-menu summary::-webkit-details-marker {
    display: none;
}

.wealth-account-menu svg {
    height: 1rem;
    width: 1rem;
}

.wealth-account-menu > div {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 18px 38px rgba(20, 38, 32, 0.14);
    display: grid;
    min-width: 11rem;
    padding: 0.35rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.3rem);
    z-index: 5;
}

.wealth-account-menu a {
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.82rem;
    padding: 0.55rem 0.62rem;
    text-decoration: none;
}

.wealth-account-menu a:hover,
.wealth-account-menu a:focus-visible {
    background: #edf6ef;
    color: var(--color-brand-700);
}

.modal-sheet,
.wealth-dialog {
    background: transparent;
    border: 0;
    margin: auto;
    max-height: min(90vh, 46rem);
    max-width: min(32rem, calc(100vw - 2rem));
    overflow: visible;
    padding: 0;
    width: 100%;
}

.modal-sheet[data-modal-size="compact"] {
    max-width: min(25rem, calc(100vw - 2rem));
}

.modal-sheet::backdrop,
.wealth-dialog::backdrop {
    background: rgba(17, 31, 27, 0.54);
}

.modal-sheet {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 26px 72px rgba(17, 31, 27, 0.26);
    color: var(--color-text);
}

.modal-sheet-body {
    display: grid;
    gap: 1rem;
    max-height: calc(min(90vh, 46rem) - 4rem);
    overflow-y: auto;
    padding: 0 1rem 1rem;
}

.wealth-dialog-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 26px 72px rgba(17, 31, 27, 0.26);
    display: grid;
    gap: 1rem;
    max-height: min(90vh, 46rem);
    overflow-y: auto;
    padding: 1rem;
}

.wealth-dialog--balance {
    max-width: min(25rem, calc(100vw - 2rem));
}

.wealth-modal-page {
    display: grid;
    margin: 0 auto;
    max-width: 34rem;
    min-height: calc(100vh - 8rem);
}

.wealth-modal-page-panel {
    align-content: start;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(20, 38, 32, 0.06);
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.modal-sheet-header,
.wealth-dialog-header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 1rem 1rem 0;
}

.modal-sheet-header {
    align-items: center;
}

.wealth-modal-page-panel .wealth-dialog-header {
    padding: 0;
}

.modal-sheet-title,
.wealth-dialog-header div {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.modal-sheet-title {
    color: var(--color-text-strong);
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

.wealth-dialog-header h1,
.wealth-dialog-header h2 {
    color: var(--color-text-strong);
    font-size: 1rem;
    line-height: 1.2;
    margin: 0;
}

.wealth-dialog-header p {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0;
}

.wealth-icon-button,
.modal-sheet-close,
.asset-account-editor-close {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 2rem;
    justify-content: center;
    padding: 0;
    text-decoration: none;
    width: 2rem;
}

.wealth-icon-button svg,
.modal-sheet-close svg,
.asset-account-editor-close svg {
    height: 1rem;
    width: 1rem;
}

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

.wealth-modal-form--snapshot {
    gap: 0.85rem;
}

.wealth-modal-help {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    margin: 0;
}

.wealth-snapshot-list {
    display: grid;
    gap: 0.55rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wealth-snapshot-selection {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    gap: 0.7rem;
    padding: 0.7rem;
}

.wealth-snapshot-selection summary {
    align-items: center;
    color: var(--color-text-strong);
    cursor: pointer;
    display: flex;
    font-size: 0.86rem;
    font-weight: var(--font-weight-bold);
    justify-content: space-between;
    list-style: none;
}

.wealth-snapshot-selection summary::-webkit-details-marker {
    display: none;
}

.wealth-snapshot-selection summary svg {
    color: var(--color-text-muted);
    height: 1rem;
    width: 1rem;
}

.wealth-snapshot-option {
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: grid;
    gap: 0.2rem 0.65rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 3.5rem;
    padding: 0.65rem 0.75rem;
}

.wealth-snapshot-option input {
    grid-row: span 2;
}

.wealth-snapshot-meta {
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: var(--font-weight-medium);
    min-width: 0;
}

.wealth-snapshot-amount {
    color: var(--color-text-strong);
    font-size: 0.9rem;
    white-space: nowrap;
}

.wealth-snapshot-status {
    color: var(--color-text-muted);
    font-size: 0.76rem;
    font-weight: var(--font-weight-medium);
    grid-column: 2 / -1;
}

.wealth-snapshot-item.is-saved .wealth-snapshot-option {
    background: #fbfaf7;
}

.wealth-snapshot-item.is-saved .wealth-snapshot-meta,
.wealth-snapshot-item.is-saved .wealth-snapshot-amount {
    color: var(--color-text-muted);
}

.wealth-money-input {
    align-items: stretch;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.wealth-money-input input {
    border-radius: 8px 0 0 8px;
    border-right: 0;
}

.wealth-money-input span {
    align-items: center;
    align-self: stretch;
    background: #fbfaf7;
    border: 1px solid var(--color-border-input);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    color: var(--color-text-muted);
    display: inline-flex;
    font-weight: var(--font-weight-bold);
    padding: 0 0.75rem;
}

.wealth-readonly-value {
    align-items: center;
    background: #fbfaf7;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-strong);
    display: flex;
    min-height: 2.5rem;
    padding: 0.65rem 0.75rem;
}

.wealth-dialog-actions {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.wealth-action-note {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    grid-column: 1 / -1;
    line-height: 1.4;
    margin: 0;
}

.wealth-modal-form--snapshot .wealth-dialog-actions {
    margin-top: 0.1rem;
}

.asset-account-editor-frame {
    background: var(--color-surface);
    box-shadow: -18px 0 48px rgba(20, 38, 32, 0.16);
    display: block;
    overflow-y: auto;
    pointer-events: none;
    position: fixed;
    transition:
        transform 0.28s ease,
        visibility 0.28s ease;
    visibility: hidden;
    z-index: 50;
}

.asset-account-editor-frame[complete] {
    pointer-events: auto;
    visibility: visible;
}

.asset-account-editor-page {
    display: grid;
    margin: 0 auto;
    max-width: 31rem;
    min-height: calc(100vh - 8rem);
}

.asset-account-editor-panel {
    align-content: start;
    background: var(--color-surface);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 100%;
    padding: 1.15rem;
}

.asset-account-editor-header {
    align-items: start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.asset-account-editor-header h2 {
    color: var(--color-text-strong);
    font-size: 1.05rem;
    line-height: 1.2;
    margin: 0;
}

.asset-account-editor-form {
    display: grid;
    gap: 0.68rem;
}

.asset-account-editor-form .wealth-field {
    gap: 0.28rem;
}

.asset-account-editor-form .wealth-field label {
    font-size: 0.74rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.25;
}

.asset-account-editor-form .wealth-field input,
.asset-account-editor-form .wealth-field select {
    font-size: 0.94rem;
    min-height: 2.3rem;
    padding: 0.5rem 0.68rem;
}

.asset-account-editor-form .wealth-field select {
    background-position:
        calc(100% - 0.92rem) 50%,
        calc(100% - 0.68rem) 50%;
    background-size:
        0.25rem 0.25rem,
        0.25rem 0.25rem;
    padding-right: 2rem;
}

.asset-account-editor-form .wealth-money-input span {
    border-color: var(--color-border-input);
    font-size: 0.94rem;
    line-height: 1;
    min-height: 2.3rem;
    padding: 0 0.7rem;
}

.asset-account-editor-note {
    align-items: center;
    background: #edf6ef;
    border-radius: 8px;
    color: var(--color-brand-700);
    display: flex;
    font-size: 0.8rem;
    gap: 0.45rem;
    line-height: 1.35;
    margin: 0;
    min-height: 2.35rem;
    padding: 0.55rem 0.65rem;
}

.asset-account-editor-note svg {
    flex: 0 0 auto;
    height: 1rem;
    width: 1rem;
}

.asset-account-editor-footer {
    align-self: end;
    display: grid;
    gap: 0.55rem;
    margin-top: auto;
}

.asset-account-editor-footer form,
.asset-account-archive-actions form {
    margin: 0;
}

.asset-account-editor-footer form > button {
    width: 100%;
}

.asset-account-archive-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.wealth-empty-state {
    background: #fbfaf7;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    gap: 0.65rem;
    min-height: 3.5rem;
    padding: 0.8rem;
}

.wealth-empty-state span {
    height: 2rem;
    width: 2rem;
}

.wealth-empty-state svg {
    height: 1rem;
    width: 1rem;
}

.wealth-empty-state p {
    margin: 0;
}

/* =========================================================================
   9. Income management
   ========================================================================= */
/* Read-mode group descriptions extend the shared section heading. */
.read-screen .wealth-account-section-heading {
    align-items: start;
}

.read-screen .wealth-account-section-heading p {
    color: var(--color-text-muted);
    font-size: 0.76rem;
    line-height: 1.3;
    margin: 0.15rem 0 0;
}

/* Segmented control for the income interval – the one piece the shared
   field and button styles do not already cover. */
.app-segmented-field {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.app-segmented-field > span {
    color: var(--color-text-muted);
    font-size: 0.78rem;
}

.app-segmented-control {
    background: #fbfaf7;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    display: grid;
    gap: 0.25rem;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    padding: 0.22rem;
}

.app-segment-option {
    margin: 0;
    min-width: 0;
    position: relative;
}

.app-segment-option input {
    cursor: pointer;
    inset: 0;
    margin: 0;
    opacity: 0;
    position: absolute;
}

.app-segment-option > span {
    align-items: center;
    border-radius: 999px;
    color: var(--color-text);
    display: flex;
    font-size: 0.82rem;
    font-weight: var(--font-weight-bold);
    justify-content: center;
    min-height: 2.1rem;
    padding: 0 0.5rem;
    text-align: center;
}

.app-segment-option input:checked + span {
    background: var(--color-brand-700);
    color: var(--color-surface);
}

.app-segment-option input:focus-visible + span {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* Let the archive form take part in the drawer footer grid directly. */
.income-editor-footer form,
.expense-editor-footer form {
    display: contents;
}
@media (min-width: 360px) {
    .dashboard-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-person-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* =========================================================================
   5. Layout — generic pages
   ========================================================================= */
body:not(.auth-body):not(.app-body) main {
    margin: 0 auto;
    max-width: 900px;
    padding: var(--page-padding-y) var(--page-padding-x);
}

/* =========================================================================
   6. Generic forms (non-auth pages)
   ========================================================================= */
main > form label,
main > form input {
    display: flex;
}

main > form :is([type="email"], [type="password"], [type="text"], textarea) {
    background: var(--color-surface);
    border: 1px solid var(--color-border-input);
    border-radius: var(--radius-sm);
    margin: 7px 0 14px;
    max-width: 400px;
    padding: 8px 6px;
    width: 100%;
}

main > form :is([type="submit"], button) {
    font-size: 1.25rem;
    font-weight: var(--font-weight-medium);
    margin: 9px 0;
    padding: 6px 9px;
}

main > form :is([type="submit"], button).link-button {
    appearance: none;
    background: transparent;
    border: 0;
    color: currentColor;
    cursor: pointer;
    display: inline;
    font: inherit;
    padding: 0;
    text-decoration: underline;
}

/* =========================================================================
   7. Flashes & shared error styles
   ========================================================================= */
.flashes {
    margin-bottom: 1rem;
}

.flash {
    background: var(--color-flash-bg);
    border: 1px solid var(--color-flash-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    padding: 0.85rem 1rem;
}

.global-error,
.input-error {
    color: var(--color-danger);
}

.global-error {
    padding-bottom: 1rem;
}

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

/* =========================================================================
   9. Auth — Page scaffold
   ========================================================================= */
.auth-body {
    background: var(--color-bg);
}

.auth-main {
    margin: 0;
    max-width: none;
    min-height: 100vh;
    padding: 0;
}

.auth-flashes {
    left: 50%;
    max-width: 390px;
    padding: 0 1rem;
    position: fixed;
    top: 1rem;
    transform: translateX(-50%);
    width: 100%;
    z-index: 10;
}

.auth-page {
    align-items: center;
    background:
        linear-gradient(
            180deg,
            rgba(255, 253, 248, 0.45),
            rgba(242, 247, 236, 0.68)
        ),
        var(--color-bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    padding: max(1.35rem, env(safe-area-inset-top)) 1rem
        max(1.35rem, env(safe-area-inset-bottom));
    position: relative;
}

.auth-page::after {
    background: linear-gradient(
        180deg,
        rgba(255, 253, 248, 0),
        rgba(215, 232, 204, 0.34)
    );
    bottom: 0;
    content: "";
    height: 28%;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    z-index: 0;
}

/* Desktop-only elements: hidden until ≥900px */
.auth-desktop-page-landscape,
.auth-desktop-panel,
.auth-desktop-illustration {
    display: none;
}

/* Shared SVG defaults inside the auth surface.
   Stroke color and width are set per component. */
.auth-page svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

/* =========================================================================
   10. Auth — Branding & desktop copy
   ========================================================================= */
.auth-brand {
    align-items: center;
    color: var(--color-text);
    display: inline-flex;
    font-size: 1rem;
    font-weight: var(--font-weight-bold);
    gap: 0.7rem;
}

.auth-brand-mark {
    align-items: center;
    background: linear-gradient(
        135deg,
        var(--color-brand-700),
        var(--color-accent-sage)
    );
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    height: 1.62rem;
    justify-content: center;
    width: 1.62rem;
}

.auth-brand-mark svg {
    height: 1rem;
    width: 1rem;
}

.auth-desktop-copy h2 {
    color: var(--color-text);
    font-size: clamp(2.25rem, 3vw, 3.1rem);
    font-weight: var(--font-weight-heavy);
    line-height: 1.08;
    margin: 0;
    max-width: 10.5em;
}

.auth-desktop-copy h2 span {
    color: var(--color-brand-700);
    display: block;
}

.auth-desktop-copy p {
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.65;
    margin: 1.35rem 0 0;
    max-width: 27rem;
}

.auth-benefits {
    display: grid;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.auth-benefits li {
    align-items: flex-start;
    display: grid;
    gap: 0.9rem;
    grid-template-columns: auto 1fr;
}

.auth-benefits span {
    align-items: center;
    border: 1px solid rgba(11, 116, 78, 0.22);
    border-radius: 0.65rem;
    color: var(--color-brand-800);
    display: inline-flex;
    height: 2.05rem;
    justify-content: center;
    width: 2.05rem;
}

.auth-benefits svg {
    height: 1.12rem;
    width: 1.12rem;
}

.auth-benefits strong {
    color: var(--color-text);
    display: block;
    font-size: 0.88rem;
    line-height: 1.25;
}

.auth-benefits p {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin: 0.2rem 0 0;
}

/* =========================================================================
   9. Auth — Card
   ========================================================================= */
.auth-card {
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.98),
        var(--color-bg-card)
    );
    border: 1px solid rgba(230, 219, 203, 0.9);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: min(100%, 390px);
    z-index: 1;
}

.auth-card-content {
    min-width: 0;
    padding: 2.65rem 1.65rem 5.7rem;
    position: relative;
    text-align: center;
    z-index: 1;
}

.auth-logo {
    align-items: center;
    display: flex;
    height: 4.15rem;
    justify-content: center;
    margin: 0 auto 1.55rem;
    width: 4.15rem;
}

.auth-logo svg {
    display: block;
    height: 3.7rem;
    stroke: url("#auth-logo-gradient");
    stroke-width: 5;
    width: 3.7rem;
}

.auth-title {
    color: var(--color-text-strong);
    font-size: 1.48rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.15;
    margin: 0;
}

.auth-subtitle {
    color: var(--color-text-muted);
    font-size: 0.91rem;
    line-height: 1.36;
    margin: 0.8rem auto 1.7rem;
    max-width: 16rem;
}

/* Card modifiers (mobile sizing) */
.auth-card--signin .auth-card-content {
    padding-bottom: 6rem;
}

.auth-card--reset .auth-card-content {
    padding-bottom: 6.25rem;
}

.auth-card--signin .auth-subtitle,
.auth-card--reset .auth-subtitle {
    max-width: 17.5rem;
}

/* Flat background matching the e-bike illustration so the full-bleed hero
   image blends into the card without a visible seam. */
.auth-card--ebike {
    background: #fdfcf8;
}

.auth-card--ebike .auth-card-content {
    padding-bottom: 2.4rem;
    padding-top: 0.4rem;
}

.auth-card--ebike .auth-subtitle {
    max-width: none;
}

.birthday-ebike-hero {
    display: block;
    height: auto;
    width: 100%;
}

/* Foto-Carousel der echten E-Bike-Bilder (Stimulus: carousel_controller).
   Fester 4:3-Rahmen; jedes Foto wird vollstaendig (contain) gezeigt, der
   Leerraum durch eine unscharf-vergroesserte Kopie desselben Bildes gefuellt,
   damit Hoch- und Querformat ohne Beschnitt nebeneinander funktionieren. */
.birthday-gallery {
    margin: 0.2rem 0 1.7rem;
    user-select: none;
}

.birthday-gallery-viewport {
    aspect-ratio: 4 / 3;
    background: rgba(20, 38, 32, 0.05);
    border-radius: var(--radius-md);
    box-shadow:
        0 10px 26px rgba(47, 65, 45, 0.16),
        inset 0 0 0 1px rgba(20, 38, 32, 0.05);
    cursor: grab;
    overflow: hidden;
    position: relative;
    touch-action: pan-y;
}

.birthday-gallery-viewport:active {
    cursor: grabbing;
}

.birthday-gallery-viewport:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

.birthday-gallery-track {
    display: flex;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform;
}

.birthday-gallery-slide {
    flex: 0 0 100%;
    margin: 0;
    overflow: hidden;
    position: relative;
}

.birthday-gallery-blur,
.birthday-gallery-photo {
    height: 100%;
    pointer-events: none;
    width: 100%;
    -webkit-user-drag: none;
}

.birthday-gallery-blur {
    filter: blur(24px) saturate(1.15);
    inset: 0;
    object-fit: cover;
    position: absolute;
    transform: scale(1.18);
}

.birthday-gallery-photo {
    display: block;
    object-fit: contain;
    position: relative;
    /* Sanftes Heranzoomen, wenn die Folie aktiv wird. */
    transform: scale(1.05);
    transition: transform 0.6s ease;
}

.birthday-gallery-slide.is-active .birthday-gallery-photo {
    transform: scale(1);
}

.birthday-gallery-nav {
    align-items: center;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    background: rgba(255, 255, 255, 0.82);
    border: 0;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(20, 38, 32, 0.22);
    color: var(--color-text-strong);
    cursor: pointer;
    display: flex;
    height: 2.4rem;
    justify-content: center;
    opacity: 1;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition:
        background var(--transition-base),
        opacity var(--transition-base),
        transform var(--transition-base);
    width: 2.4rem;
}

.birthday-gallery-nav svg {
    height: 1.3rem;
    width: 1.3rem;
}

.birthday-gallery-nav--prev {
    left: 0.6rem;
}

.birthday-gallery-nav--next {
    right: 0.6rem;
}

.birthday-gallery-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.06);
}

.birthday-gallery-nav:disabled {
    cursor: default;
    opacity: 0;
    pointer-events: none;
}

.birthday-gallery-dots {
    align-items: center;
    display: flex;
    gap: 0.42rem;
    justify-content: center;
    margin-top: 0.85rem;
}

.birthday-gallery-dot {
    background: rgba(20, 38, 32, 0.18);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    height: 0.42rem;
    padding: 0;
    transition:
        background var(--transition-base),
        width var(--transition-base);
    width: 0.42rem;
}

.birthday-gallery-dot:hover {
    background: rgba(20, 38, 32, 0.34);
}

.birthday-gallery-dot.is-active {
    background: var(--color-brand-700);
    width: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
    .birthday-gallery-track,
    .birthday-gallery-photo,
    .birthday-gallery-nav,
    .birthday-gallery-dot {
        transition: none;
    }

    .birthday-gallery-photo {
        transform: scale(1);
    }
}

/* =========================================================================
   10. Auth — Form & fields
   ========================================================================= */
.auth-form {
    display: grid;
    gap: 0.82rem;
    text-align: left;
}

.auth-form--reset {
    gap: 1.42rem;
}

.field {
    display: grid;
    gap: 0.42rem;
}

.input-wrapper {
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-input-inset);
    display: flex;
    min-height: 3.05rem;
    position: relative;
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base),
        background var(--transition-base);
}

.input-wrapper:focus-within {
    border-color: rgba(11, 116, 78, 0.68);
    box-shadow: 0 0 0 3px rgba(11, 116, 78, 0.12);
}

.input-wrapper input {
    background: transparent;
    border: 0;
    border-radius: inherit;
    color: var(--color-text);
    font-size: 0.88rem;
    line-height: 1.2;
    margin: 0;
    min-height: 2.95rem;
    min-width: 0;
    outline: 0;
    padding: 0.72rem 1rem 0.72rem 2.76rem;
    width: 100%;
}

.input-wrapper input::placeholder {
    color: var(--color-text-placeholder);
    opacity: 1;
}

.input-wrapper input[readonly] {
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.input-wrapper.has-trailing input {
    padding-right: 2.7rem;
}

.input-icon {
    color: var(--color-text-icon);
    display: inline-flex;
    left: 0.9rem;
    pointer-events: none;
    position: absolute;
}

.input-icon-trailing {
    left: auto;
    right: 0.9rem;
}

.input-icon svg {
    height: 1.08rem;
    width: 1.08rem;
}

.password-visibility-toggle {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 0.45rem;
    color: var(--color-text-icon);
    cursor: pointer;
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    padding: 0;
    position: absolute;
    right: 0.42rem;
    top: 50%;
    transform: translateY(-50%);
    transition: background var(--transition-base), color var(--transition-base);
    width: 2rem;
    z-index: 1;
}

.password-visibility-toggle:hover {
    background: rgba(11, 116, 78, 0.08);
    color: var(--color-brand-700);
}

.password-visibility-toggle:focus-visible {
    outline: 2px solid var(--color-brand-700);
    outline-offset: 1px;
}

.password-visibility-toggle span {
    display: inline-flex;
}

.password-visibility-toggle [hidden] {
    display: none;
}

.password-visibility-toggle svg {
    height: 1.08rem;
    width: 1.08rem;
}

/* Inline & summary error messaging */
.auth-error-summary {
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-md);
    color: var(--color-danger);
    font-size: 0.85rem;
    line-height: 1.35;
    margin: 0;
    padding: 0.75rem 0.85rem;
}

.auth-error-summary p,
.input-error p {
    margin: 0;
}

.input-error {
    font-size: 0.8rem;
    line-height: 1.35;
    padding-left: 0.15rem;
}

.field-hint {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
    margin: 0;
    padding-left: 0.15rem;
}

/* =========================================================================
   10b. Auth — Birthday greeting card
   ========================================================================= */
.auth-card--birthday .auth-card-content {
    padding-bottom: 2.4rem;
}

.birthday-hero {
    display: block;
    height: auto;
    margin: -0.9rem auto 1rem;
    width: min(100%, 330px);
}

.birthday-wishes {
    color: var(--color-text);
    display: grid;
    font-size: 0.95rem;
    gap: 0.9rem;
    line-height: 1.5;
    margin: 1.1rem auto 1.6rem;
}

.birthday-wishes p {
    margin: 0;
}

.birthday-dialogue {
    color: var(--color-text-muted);
    display: grid;
    font-style: italic;
    gap: 0.2rem;
}

.birthday-footnote {
    color: var(--color-text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
    margin: 1.25rem auto 0;
    max-width: 18rem;
}

/* =========================================================================
   11. Auth — Terms checkbox
   ========================================================================= */
.terms-field {
    align-items: start;
    color: var(--color-text-muted);
    display: grid;
    font-size: 0.82rem;
    gap: 0.65rem;
    grid-template-columns: auto 1fr;
    line-height: 1.45;
    margin: 0.18rem 0 0.52rem;
}

.terms-field label {
    font-weight: var(--font-weight-medium);
}

.terms-field input {
    appearance: none;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-checkbox);
    border-radius: 0.28rem;
    cursor: pointer;
    display: grid;
    height: 1.06rem;
    margin: 0.12rem 0 0;
    place-content: center;
    transition:
        background var(--transition-base),
        border-color var(--transition-base),
        box-shadow var(--transition-base);
    width: 1.06rem;
}

.terms-field input::before {
    border: solid #fff;
    border-width: 0 0 2px 2px;
    content: "";
    height: 0.32rem;
    transform: rotate(-45deg) scale(0);
    transition: transform 140ms ease;
    width: 0.58rem;
}

.terms-field input:checked {
    background: var(--color-brand-700);
    border-color: var(--color-brand-700);
}

.terms-field input:checked::before {
    transform: rotate(-45deg) scale(1);
}

/* =========================================================================
   12. Auth — Buttons & links
   ========================================================================= */
.auth-button {
    align-items: center;
    background: linear-gradient(
        180deg,
        var(--color-brand-from) 0%,
        var(--color-brand-800) 100%
    );
    border: 0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-button);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.94rem;
    font-weight: var(--font-weight-bold);
    justify-content: center;
    min-height: 2.95rem;
    padding: 0.82rem 1rem;
    transition:
        background var(--transition-base),
        box-shadow var(--transition-base),
        transform var(--transition-base);
    width: 100%;
}

.auth-button:hover {
    background: linear-gradient(
        180deg,
        var(--color-brand-hover-from) 0%,
        var(--color-brand-hover-to) 100%
    );
    box-shadow: var(--shadow-button-hover);
    transform: translateY(-1px);
}

.auth-button:active {
    box-shadow: var(--shadow-button-active);
    transform: translateY(0);
}

/* Disabled state — explicit `disabled` attribute or unchecked terms */
.auth-button:disabled,
.auth-form:has(.terms-field input:not(:checked)) .auth-button {
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.auth-form:has(.terms-field input:not(:checked)) .auth-button {
    pointer-events: none;
}

/* Auth links — typographic baseline */
.auth-link,
.auth-footer a,
.auth-forgot-password,
.auth-back-link {
    color: var(--color-brand-700);
    font-weight: var(--font-weight-bold);
    text-decoration: none;
}

.auth-link:hover,
.auth-footer a:hover,
.auth-forgot-password:hover,
.auth-back-link:hover {
    color: var(--color-brand-800);
    text-decoration: underline;
}

/* Layout-specific link variants */
.auth-forgot-password {
    display: inline-block;
    font-size: 0.84rem;
    line-height: 1.35;
    margin-top: 1.15rem;
    position: relative;
    z-index: 2;
}

.auth-back-link {
    align-items: center;
    display: inline-flex;
    font-size: 0.84rem;
    gap: 0.45rem;
    justify-content: center;
    line-height: 1.35;
    margin-top: 2.18rem;
    position: relative;
    z-index: 2;
}

.auth-back-link svg {
    height: 1rem;
    width: 1rem;
}

.auth-footer {
    color: var(--color-text-muted);
    font-size: 0.84rem;
    line-height: 1.35;
    margin: 1.55rem 0 0;
    position: relative;
    z-index: 2;
}

/* Shared focus ring for all interactive auth elements */
.terms-field input:focus-visible,
.auth-button:focus-visible,
.auth-link:focus-visible,
.auth-forgot-password:focus-visible,
.auth-back-link:focus-visible,
.auth-footer a:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-ring-offset);
}

/* =========================================================================
   13. Auth — Reset note & illustration
   ========================================================================= */
.auth-reset-note {
    align-items: center;
    background: rgba(237, 245, 229, 0.78);
    border: 1px solid rgba(182, 205, 168, 0.38);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    display: grid;
    font-size: 0.8rem;
    gap: 0.8rem;
    grid-template-columns: auto 1fr;
    line-height: 1.35;
    margin-top: 1.62rem;
    padding: 0.85rem 1rem;
    position: relative;
    text-align: left;
    z-index: 2;
}

.auth-reset-note span {
    align-items: center;
    color: var(--color-brand-700);
    display: inline-flex;
    justify-content: center;
}

.auth-reset-note svg {
    height: 1.45rem;
    stroke-width: 1.9;
    width: 1.45rem;
}

.auth-reset-note p {
    margin: 0;
}

.auth-illustration {
    background: linear-gradient(
        180deg,
        rgba(255, 254, 250, 0),
        rgba(236, 245, 229, 0.75)
    );
    bottom: -1px;
    height: 5.25rem;
    left: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    right: 0;
    z-index: 0;
}

.auth-illustration::before {
    background: linear-gradient(
        180deg,
        var(--color-bg-card) 0%,
        rgba(255, 254, 250, 0) 72%
    );
    content: "";
    height: 2rem;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1;
}

.auth-illustration img {
    bottom: -0.25rem;
    display: block;
    filter: saturate(0.98);
    left: 50%;
    max-width: none;
    opacity: 0.72;
    position: absolute;
    transform: translateX(-50%);
    width: 160%;
}

/* =========================================================================
   14. Responsive
   ========================================================================= */
@media (max-width: 520px) {
    body:not(.auth-body):not(.app-body) main {
        padding: 1.5rem;
    }

    .auth-page {
        align-items: stretch;
    }

    .auth-main {
        padding: 0;
    }

    .auth-card {
        max-width: 390px;
        width: calc(100vw - 2rem);
    }

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

    .dashboard-chart-summary span + span {
        border-left: 0;
        border-top: 1px solid var(--color-border);
    }
}

@media (min-width: 560px) {
    .auth-page {
        padding: 2.2rem 1.5rem 3rem;
    }

    .setup-card {
        padding: 1.65rem;
    }

    .setup-actions {
        align-items: center;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .setup-secondary-action {
        min-width: 8.4rem;
    }

    .auth-card-content {
        padding-left: 1.85rem;
        padding-right: 1.85rem;
    }
}

@media (min-width: 900px) {
    .app-shell {
        display: grid;
        grid-template-columns: 15.5rem minmax(0, 1fr);
    }

    .app-sidebar {
        align-content: start;
        background: rgba(255, 255, 255, 0.78);
        border-right: 1px solid var(--color-border);
        display: grid;
        gap: 2rem;
        height: 100vh;
        padding: 1.55rem 1rem;
        position: sticky;
        top: 0;
    }

    .app-mobile-header,
    .app-bottom-nav {
        display: none;
    }

    .app-brand-mark {
        height: 2.2rem;
        width: 2.2rem;
    }

    body.app-body .app-main {
        max-width: 1180px;
        padding: 2rem clamp(1.5rem, 3vw, 3rem) 4rem;
    }

    .setup-screen {
        gap: 1.65rem;
        margin: 0 auto;
        max-width: 68.75rem;
        padding-top: 1.2rem;
    }

    .setup-header {
        gap: 0.85rem;
    }

    .setup-header h1 {
        font-size: 3rem;
    }

    .setup-stepper strong {
        font-size: 1.05rem;
    }

    .setup-card {
        align-items: center;
        gap: 3.25rem;
        grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.78fr);
        min-height: 31.25rem;
        padding: 3rem 3.25rem;
    }

    .setup-form-panel {
        gap: 1.55rem;
    }

    .setup-intro {
        gap: 1.15rem;
    }

    .setup-intro h2 {
        font-size: 1.55rem;
    }

    .setup-form {
        gap: 1.15rem;
        max-width: 31.75rem;
    }

    .setup-primary-action {
        font-size: 1.02rem;
    }

    .setup-visual-panel {
        gap: 1.35rem;
    }

    .setup-house-illustration {
        max-width: 22.25rem;
    }

    .setup-privacy-note {
        margin-top: 0.2rem;
    }

    .dashboard-screen {
        gap: 1.1rem;
    }

    .dashboard-title h1 {
        font-size: 2.05rem;
    }

    .dashboard-kpi-card {
        min-height: 5.6rem;
        padding: 1rem 1.1rem;
    }

    .dashboard-kpi-card strong {
        font-size: 1.28rem;
        white-space: nowrap;
    }

    .dashboard-kpi-card--primary strong {
        font-size: 1.55rem;
    }

    .dashboard-kpis {
        grid-template-columns: minmax(18rem, 2fr) repeat(3, minmax(9rem, 1fr));
    }

    .dashboard-kpi-card--primary {
        grid-column: auto;
    }

    .dashboard-kpi-card:nth-child(4) {
        grid-column: auto;
    }

    .dashboard-kpi-card--desktop {
        display: grid;
    }

    .dashboard-primary-grid {
        grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.95fr);
    }

    .dashboard-person-panel {
        order: 2;
    }

    .dashboard-chart-panel {
        order: 1;
    }

    .dashboard-person-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-person-card {
        align-items: center;
        min-height: 4.85rem;
    }

    .dashboard-secondary-grid {
        grid-template-columns: minmax(0, 1.45fr) minmax(17rem, 1fr);
    }

    .dashboard-cashflow-summary {
        align-items: center;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-space-index-header {
        display: flex;
        justify-content: space-between;
    }

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

    .finance-space-card {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
    }

    .finance-space-card > svg {
        display: block;
    }

    .people-header {
        display: flex;
        justify-content: space-between;
    }

    .people-screen {
        gap: 1.1rem;
    }

    .people-panel {
        padding: 1rem;
    }

    .people-card {
        gap: 1rem;
    }

    .people-card-actions {
        justify-content: space-between;
    }

    .read-screen {
        gap: 1.1rem;
    }

    .read-header {
        display: flex;
        justify-content: space-between;
    }

    .wealth-category-panel,
    .wealth-account-panel {
        padding: 1rem;
    }

    .read-summary-grid.read-summary-grid--wide {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .wealth-summary-card.is-primary {
        grid-column: auto;
    }

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

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

    .wealth-account-amount {
        justify-self: end;
    }

    .wealth-account-actions {
        flex-wrap: nowrap;
        justify-content: end;
    }

    .wealth-account-action--desktop {
        display: inline-flex;
    }

    .wealth-account-action--mobile {
        display: none;
    }

    .wealth-category-edit span,
    .wealth-category-action span {
        display: inline;
    }

    .asset-account-editor-frame {
        bottom: 0;
        right: 0;
        top: 0;
        transform: translateX(100%);
        width: min(28rem, 42vw);
    }

    .asset-account-editor-frame[complete] {
        transform: translateX(0);
    }

    .asset-account-editor-frame.drawer-hide {
        transform: translateX(100%);
    }

    .asset-account-editor-footer {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .asset-account-archive-actions {
        flex-wrap: nowrap;
        justify-content: end;
    }

    .read-summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .income-editor-footer,
    .expense-editor-footer {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .auth-page {
        align-content: center;
        display: grid;
        gap: clamp(3rem, 7vw, 6.25rem);
        grid-template-columns: minmax(360px, 540px) minmax(390px, 430px);
        justify-content: center;
        padding: clamp(2rem, 4vw, 3.25rem);
    }

    .auth-desktop-panel {
        align-self: stretch;
        display: grid;
        grid-template-rows: auto auto auto 1fr;
        min-height: min(720px, calc(100vh - 4rem));
        position: relative;
        z-index: 1;
    }

    .auth-desktop-copy {
        margin-top: clamp(4rem, 8vh, 6.5rem);
    }

    .auth-desktop-copy h2 {
        max-width: 9.8em;
    }

    .auth-benefits {
        margin-top: clamp(2.2rem, 4vh, 3.5rem);
        max-width: 28rem;
    }

    .auth-desktop-illustration {
        align-self: end;
        display: block;
        height: clamp(13.5rem, 30vh, 19rem);
        margin-top: 2rem;
        overflow: visible;
        position: relative;
    }

    .auth-desktop-page-landscape {
        bottom: -0.5rem;
        display: block;
        filter: saturate(0.96);
        height: min(34vh, 22rem);
        left: 0;
        object-fit: cover;
        object-position: center bottom;
        opacity: 0.74;
        pointer-events: none;
        position: absolute;
        user-select: none;
        width: 100%;
        z-index: 0;
    }

    .auth-desktop-people {
        bottom: 0.25rem;
        display: block;
        filter: saturate(0.98);
        left: 50%;
        max-width: none;
        pointer-events: none;
        position: absolute;
        transform: translateX(-50%);
        user-select: none;
        width: min(100%, 36rem);
        z-index: 1;
    }

    .auth-desktop-signin-people {
        bottom: -0.15rem;
        width: min(134%, 48rem);
    }

    .auth-desktop-reset-people {
        bottom: -0.85rem;
        filter: saturate(0.98) drop-shadow(0 14px 18px rgba(64, 85, 58, 0.1));
        left: 51%;
        width: min(52%, 18rem);
    }

    .auth-card {
        max-width: 430px;
        width: min(100%, 430px);
    }

    .auth-card-content {
        padding: 2.2rem 2.1rem 2.35rem;
    }

    .auth-card--signin .auth-card-content,
    .auth-card--reset .auth-card-content {
        padding-bottom: 2.35rem;
    }

    .auth-logo {
        height: 3.45rem;
        margin-bottom: 1.2rem;
        width: 3.45rem;
    }

    .auth-logo svg {
        height: 3.1rem;
        width: 3.1rem;
    }

    .auth-title {
        font-size: 1.55rem;
    }

    .auth-subtitle {
        margin-bottom: 1.9rem;
    }

    .auth-form {
        gap: 0.95rem;
    }

    .terms-field {
        margin-top: 0.1rem;
    }

    .auth-footer {
        margin-top: 1.55rem;
    }

    .auth-forgot-password {
        margin-top: 1.2rem;
    }

    .auth-illustration {
        display: none;
    }
}
