:root {
    --font-sans: "Bricolage Grotesque", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --icon-btn-size: 44px;
    --icon-btn-radius: 999px;
    --icon-btn-bg-muted: #f6f6f6;
    --icon-btn-bg-muted-hover: #ebebeb;
    --icon-size: 24px;
    --app-max-width: 800px;

    /* Color tokens (existing palette, centralized) */
    --color-text: #111;
    --color-icon: var(--color-text); /* Figma foreground #111111 */
    --color-text-secondary: #1d1d1f;
    --color-muted: #797979;
    --color-muted-apple: #6e6e73;
    --color-border: #d2d2d7;
    --color-placeholder: #d6d6d6;
    --color-surface-muted: #f6f6f6;
    --color-focus: #2f51eb;
    --color-danger: #c53030;
    --color-success: #0a7c42;
    --color-positive-bg: #e3f893;
    --color-toggle-on: #34c759;
    --color-btn-dark: #111;
    --color-btn-dark-hover: #111;
    --color-btn-secondary: #f6f6f6;
    --color-icon-btn-dark: #202020;
    --radius-input: 8px;
    --radius-btn: 8px;

    /* iOS large-title header */
    --header-toolbar-height: 56px;
    --header-large-title-height: 56px;
    --header-btn-size: 40px;
    --header-compact-size: 12px;
    --header-motion: 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    --header-motion-spring: 0.42s cubic-bezier(0.22, 1.18, 0.36, 1);
}

/* ——— Shared primitives ——— */
.icon-btn {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border: none;
    border-radius: var(--icon-btn-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    color: var(--color-text);
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
}

.icon-btn--muted {
    background: var(--icon-btn-bg-muted);
}

.icon-btn--muted:hover {
    background: var(--icon-btn-bg-muted-hover);
}

.icon-btn--dark {
    background: #000;
    color: #fff;
}

.icon-btn--dark:hover {
    background: #333;
}

.icon-btn--dark:active {
    transform: scale(0.98);
}

.icon-btn--profile {
    background: var(--color-icon-btn-dark);
    overflow: hidden;
}

.icon-btn--profile:hover {
    opacity: 0.9;
}

.icon-btn-close-icon {
    width: var(--icon-size);
    height: var(--icon-size);
    display: block;
    background-color: currentColor;
    -webkit-mask: url("../assets/img/icons/times.svg") center / contain no-repeat;
    mask: url("../assets/img/icons/times.svg") center / contain no-repeat;
    -webkit-mask-source-type: alpha;
    mask-mode: alpha;
}

/* Figma Unicons — 24×24, color via currentColor / --color-icon */
.icon {
    display: inline-block;
    width: var(--icon-size);
    height: var(--icon-size);
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-source-type: alpha;
    mask-mode: alpha;
    vertical-align: middle;
}

.icon--sm {
    width: 20px;
    height: 20px;
}

.icon--angle-up { -webkit-mask-image: url("../assets/img/icons/angle-up.svg"); mask-image: url("../assets/img/icons/angle-up.svg"); }
.icon--angle-right { -webkit-mask-image: url("../assets/img/icons/angle-right.svg"); mask-image: url("../assets/img/icons/angle-right.svg"); }
.icon--angle-left { -webkit-mask-image: url("../assets/img/icons/angle-left.svg"); mask-image: url("../assets/img/icons/angle-left.svg"); }
.icon--angle-down { -webkit-mask-image: url("../assets/img/icons/angle-down.svg"); mask-image: url("../assets/img/icons/angle-down.svg"); }
.icon--arrow-up { -webkit-mask-image: url("../assets/img/icons/arrow-up.svg"); mask-image: url("../assets/img/icons/arrow-up.svg"); }
.icon--arrow-down { -webkit-mask-image: url("../assets/img/icons/arrow-down.svg"); mask-image: url("../assets/img/icons/arrow-down.svg"); }
.icon--arrow-left { -webkit-mask-image: url("../assets/img/icons/arrow-left.svg"); mask-image: url("../assets/img/icons/arrow-left.svg"); }
.icon--arrow-right { -webkit-mask-image: url("../assets/img/icons/arrow-right.svg"); mask-image: url("../assets/img/icons/arrow-right.svg"); }
.icon--arrow-up-right { -webkit-mask-image: url("../assets/img/icons/arrow-up-right.svg"); mask-image: url("../assets/img/icons/arrow-up-right.svg"); }
.icon--euro { -webkit-mask-image: url("../assets/img/icons/euro.svg"); mask-image: url("../assets/img/icons/euro.svg"); }
.icon--dollar-alt { -webkit-mask-image: url("../assets/img/icons/dollar-alt.svg"); mask-image: url("../assets/img/icons/dollar-alt.svg"); }
.icon--bill { -webkit-mask-image: url("../assets/img/icons/bill.svg"); mask-image: url("../assets/img/icons/bill.svg"); }
.icon--money-insert { -webkit-mask-image: url("../assets/img/icons/money-insert.svg"); mask-image: url("../assets/img/icons/money-insert.svg"); }
.icon--money-withdraw { -webkit-mask-image: url("../assets/img/icons/money-withdraw.svg"); mask-image: url("../assets/img/icons/money-withdraw.svg"); }
.icon--pricetag-alt { -webkit-mask-image: url("../assets/img/icons/pricetag-alt.svg"); mask-image: url("../assets/img/icons/pricetag-alt.svg"); }
.icon--user { -webkit-mask-image: url("../assets/img/icons/user.svg"); mask-image: url("../assets/img/icons/user.svg"); }
.icon--user-circle { -webkit-mask-image: url("../assets/img/icons/user-circle.svg"); mask-image: url("../assets/img/icons/user-circle.svg"); }
.icon--user-minus { -webkit-mask-image: url("../assets/img/icons/user-minus.svg"); mask-image: url("../assets/img/icons/user-minus.svg"); }
.icon--user-plus { -webkit-mask-image: url("../assets/img/icons/user-plus.svg"); mask-image: url("../assets/img/icons/user-plus.svg"); }
.icon--users,
.icon--users-alt { -webkit-mask-image: url("../assets/img/icons/users-alt.svg"); mask-image: url("../assets/img/icons/users-alt.svg"); }
.icon--chart-pie { -webkit-mask-image: url("../assets/img/icons/chart-pie.svg"); mask-image: url("../assets/img/icons/chart-pie.svg"); }
.icon--chart-pie-alt { -webkit-mask-image: url("../assets/img/icons/chart-pie-alt.svg"); mask-image: url("../assets/img/icons/chart-pie-alt.svg"); }
.icon--chart { -webkit-mask-image: url("../assets/img/icons/chart.svg"); mask-image: url("../assets/img/icons/chart.svg"); }
.icon--create-dashboard { -webkit-mask-image: url("../assets/img/icons/create-dashboard.svg"); mask-image: url("../assets/img/icons/create-dashboard.svg"); }
.icon--pizza-slice { -webkit-mask-image: url("../assets/img/icons/pizza-slice.svg"); mask-image: url("../assets/img/icons/pizza-slice.svg"); }
.icon--file-alt { -webkit-mask-image: url("../assets/img/icons/file-alt.svg"); mask-image: url("../assets/img/icons/file-alt.svg"); }
.icon--file-shield-alt { -webkit-mask-image: url("../assets/img/icons/file-shield-alt.svg"); mask-image: url("../assets/img/icons/file-shield-alt.svg"); }
.icon--clipboard { -webkit-mask-image: url("../assets/img/icons/clipboard.svg"); mask-image: url("../assets/img/icons/clipboard.svg"); }
.icon--edit { -webkit-mask-image: url("../assets/img/icons/edit.svg"); mask-image: url("../assets/img/icons/edit.svg"); }
.icon--pen { -webkit-mask-image: url("../assets/img/icons/pen.svg"); mask-image: url("../assets/img/icons/pen.svg"); }
.icon--plus { -webkit-mask-image: url("../assets/img/icons/plus.svg"); mask-image: url("../assets/img/icons/plus.svg"); }
.icon--check { -webkit-mask-image: url("../assets/img/icons/check.svg"); mask-image: url("../assets/img/icons/check.svg"); }
.icon--times { -webkit-mask-image: url("../assets/img/icons/times.svg"); mask-image: url("../assets/img/icons/times.svg"); }
.icon--times-circle { -webkit-mask-image: url("../assets/img/icons/times-circle.svg"); mask-image: url("../assets/img/icons/times-circle.svg"); }
.icon--trash,
.icon--trash-alt { -webkit-mask-image: url("../assets/img/icons/trash-alt.svg"); mask-image: url("../assets/img/icons/trash-alt.svg"); }
.icon--save { -webkit-mask-image: url("../assets/img/icons/save.svg"); mask-image: url("../assets/img/icons/save.svg"); }
.icon--sync { -webkit-mask-image: url("../assets/img/icons/sync.svg"); mask-image: url("../assets/img/icons/sync.svg"); }
.icon--ellipsis-h { -webkit-mask-image: url("../assets/img/icons/ellipsis-h.svg"); mask-image: url("../assets/img/icons/ellipsis-h.svg"); }
.icon--spinner-alt { -webkit-mask-image: url("../assets/img/icons/spinner-alt.svg"); mask-image: url("../assets/img/icons/spinner-alt.svg"); }
.icon--eye { -webkit-mask-image: url("../assets/img/icons/eye.svg"); mask-image: url("../assets/img/icons/eye.svg"); }
.icon--eye-slash { -webkit-mask-image: url("../assets/img/icons/eye-slash.svg"); mask-image: url("../assets/img/icons/eye-slash.svg"); }
.icon--lock { -webkit-mask-image: url("../assets/img/icons/lock.svg"); mask-image: url("../assets/img/icons/lock.svg"); }
.icon--filter-slash { -webkit-mask-image: url("../assets/img/icons/filter-slash.svg"); mask-image: url("../assets/img/icons/filter-slash.svg"); }
.icon--filter { -webkit-mask-image: url("../assets/img/icons/filter.svg"); mask-image: url("../assets/img/icons/filter.svg"); }
.icon--thumbs-up { -webkit-mask-image: url("../assets/img/icons/thumbs-up.svg"); mask-image: url("../assets/img/icons/thumbs-up.svg"); }
.icon--thumbs-down { -webkit-mask-image: url("../assets/img/icons/thumbs-down.svg"); mask-image: url("../assets/img/icons/thumbs-down.svg"); }
.icon--info-circle { -webkit-mask-image: url("../assets/img/icons/info-circle.svg"); mask-image: url("../assets/img/icons/info-circle.svg"); }
.icon--home-alt { -webkit-mask-image: url("../assets/img/icons/home-alt.svg"); mask-image: url("../assets/img/icons/home-alt.svg"); }
.icon--setting { -webkit-mask-image: url("../assets/img/icons/setting.svg"); mask-image: url("../assets/img/icons/setting.svg"); }
.icon--globe { -webkit-mask-image: url("../assets/img/icons/globe.svg"); mask-image: url("../assets/img/icons/globe.svg"); }
.icon--apps { -webkit-mask-image: url("../assets/img/icons/apps.svg"); mask-image: url("../assets/img/icons/apps.svg"); }
.icon--calendar { -webkit-mask-image: url("../assets/img/icons/calendar.svg"); mask-image: url("../assets/img/icons/calendar.svg"); }
.icon--bell { -webkit-mask-image: url("../assets/img/icons/bell.svg"); mask-image: url("../assets/img/icons/bell.svg"); }
.icon--exchange { -webkit-mask-image: url("../assets/img/icons/exchange.svg"); mask-image: url("../assets/img/icons/exchange.svg"); }
.icon--exchange-alt { -webkit-mask-image: url("../assets/img/icons/exchange-alt.svg"); mask-image: url("../assets/img/icons/exchange-alt.svg"); }
.icon--history-alt { -webkit-mask-image: url("../assets/img/icons/history-alt.svg"); mask-image: url("../assets/img/icons/history-alt.svg"); }
.icon--direction { -webkit-mask-image: url("../assets/img/icons/direction.svg"); mask-image: url("../assets/img/icons/direction.svg"); }
.icon--arrows-v { -webkit-mask-image: url("../assets/img/icons/arrows-v.svg"); mask-image: url("../assets/img/icons/arrows-v.svg"); }
.icon--cloud-download { -webkit-mask-image: url("../assets/img/icons/cloud-download.svg"); mask-image: url("../assets/img/icons/cloud-download.svg"); }
.icon--english-to-chinese { -webkit-mask-image: url("../assets/img/icons/english-to-chinese.svg"); mask-image: url("../assets/img/icons/english-to-chinese.svg"); }
.icon--apple { -webkit-mask-image: url("../assets/img/icons/apple.svg"); mask-image: url("../assets/img/icons/apple.svg"); }

.icon--google {
    background-color: transparent;
    -webkit-mask-image: none;
    mask-image: none;
    background-image: url("../assets/img/icons/google.svg");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.icon--spin,
.btn--loading::after {
    animation: icon-spin 1.1s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .icon--spin,
    .btn--loading::after {
        animation: none;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    width: 100%;
    max-width: 400px;
    min-width: 40px;
    height: 56px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    border-radius: var(--radius-btn);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.btn--lg {
    height: 56px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 20px;
}

.btn--md {
    height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    line-height: 20px;
}

.btn--sm {
    height: 32px;
    padding: 6px 12px;
    font-size: 12px;
    line-height: 16px;
}

.btn--primary {
    color: #f6f6f6;
    background: var(--color-btn-dark);
}

.btn--primary:hover {
    background-image: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2));
}

.btn--secondary {
    color: var(--color-text);
    background: var(--color-btn-secondary);
    border-color: var(--color-btn-secondary);
}

.btn--secondary:hover {
    background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
}

.btn--danger {
    color: var(--color-danger);
    background: transparent;
    border: 1px solid var(--color-danger);
    margin-top: 12px;
}

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

.btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px #fff,
        0 0 0 6px var(--color-focus);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

/* Loading: spinner replaces label; keep button width/height */
.btn--loading,
.btn--loading:disabled,
.btn--loading[disabled] {
    gap: 0;
    color: transparent;
    opacity: 1;
    cursor: wait;
    pointer-events: none;
    background-image: none;
}

.btn--loading > * {
    visibility: hidden;
}

.btn--loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 24px;
    height: 24px;
    background-color: #f6f6f6;
    -webkit-mask: url("../assets/img/icons/spinner-alt.svg") center / contain no-repeat;
    mask: url("../assets/img/icons/spinner-alt.svg") center / contain no-repeat;
    -webkit-mask-source-type: alpha;
    mask-mode: alpha;
}

.btn--primary.btn--loading::after {
    background-color: #f6f6f6;
}

.btn--secondary.btn--loading::after,
.btn--danger.btn--loading::after {
    background-color: var(--color-text);
}

.btn--danger.btn--loading {
    background: var(--color-btn-secondary);
    border-color: var(--color-btn-secondary);
}

.section-title,
.profile-menu-section-title,
.categories-section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    margin: 0;
}

/* ——— Shared List chrome (Figma Lists 523:4785) ——— */
.list-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.list-group[hidden],
.list-group.section-header--empty {
    display: none;
}

.list-group-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.48px;
    color: var(--color-text);
    margin: 0;
    line-height: normal;
}

.list-group-title--anchor {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.48px;
    color: var(--color-text);
    line-height: normal;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s ease;
}

.list-group-title--anchor:hover {
    opacity: 0.72;
}

.list-group-title--anchor:focus-visible {
    outline: 2px solid #2f51eb;
    outline-offset: 2px;
    border-radius: 4px;
}

.list-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    padding: 16px;
    border-radius: 8px;
    background: var(--color-surface-muted);
    overflow: clip;
    box-sizing: border-box;
}

.list-card--muted {
    opacity: 0.5;
}

/* Nested lists inside a card: reset default list padding.
   When the card IS the list (ul.entry-list.list-card), keep the 16px card padding. */
.list-card > .entry-list,
.list-card > .categories-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-card.entry-list,
.list-card.categories-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 16px;
}

.list-caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-align: center;
}

.list-caption--after-future {
    gap: 0;
}

.list-caption-line {
    display: block;
    width: 25px;
    height: 5px;
    margin: 10px 0;
    background: url("../assets/img/list-caption-line.svg") center / contain no-repeat;
    transform: rotate(90deg);
    transform-origin: center;
}

.list-caption-text {
    margin: 0;
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: #000;
    text-decoration: underline;
    text-underline-position: from-font;
}

.list-caption--future .list-caption-text {
    margin-bottom: 8px;
}

.list-caption--future .list-caption-line {
    order: 2;
}

.list-caption--more .list-caption-text {
    text-decoration: none;
}

.list-caption-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    text-decoration: underline;
    text-underline-position: from-font;
    cursor: pointer;
}

.section-title--caps,
.profile-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    margin-bottom: 12px;
}

.categories-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.categories-section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.48px;
    color: var(--color-text);
    margin: 0;
    line-height: normal;
}

.categories-section-count {
    display: none;
}

#spaces-settings-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#personen-list:empty,
#categories-list-vertraege:empty,
#categories-list-einkommen:empty {
    display: none;
}

.badge-shared,
.shared-inline-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
    color: inherit;
    text-transform: none;
}

.badge-shared--on-card,
.wallet-card-shared-badge {
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
    display: inline-block;
    color: #111;
}

.error-message {
    display: block;
    font-size: 0.85rem;
    color: var(--color-danger);
    min-height: 1.2em;
    margin: -4px 0 8px;
}

/* Floating-label field (Figma Input) */
.float-field {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 12px;
}

.float-field[hidden] {
    display: none !important;
}

.float-field-control {
    display: block;
    width: 100%;
    height: 64px;
    min-height: 64px;
    padding: 16px;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: var(--color-text);
    border: 2px solid var(--color-surface-muted);
    border-radius: var(--radius-input);
    background: var(--color-surface-muted);
    transition: border-color 0.2s, padding 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.float-field-control::placeholder {
    color: transparent;
}

.float-field-control:focus {
    outline: none;
    border-color: var(--color-focus);
}

.float-field:focus-within .float-field-control,
.float-field--filled .float-field-control,
.float-field:has(input:not(:placeholder-shown)) .float-field-control,
.float-field:has(textarea:not(:placeholder-shown)) .float-field-control {
    padding-top: 24px;
    padding-bottom: 10px;
}

.float-field-label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: var(--color-text);
    pointer-events: none;
    transition: top 0.15s ease, transform 0.15s ease, font-size 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
    max-width: calc(100% - 48px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.float-field:focus-within .float-field-label,
.float-field--filled .float-field-label,
.float-field:has(input:not(:placeholder-shown)) .float-field-label,
.float-field:has(textarea:not(:placeholder-shown)) .float-field-label {
    top: 12px;
    transform: none;
    font-size: 11px;
    opacity: 0.5;
}

.float-field.is-error .float-field-control {
    border-color: var(--color-danger);
}

.float-field--select .float-field-control {
    padding-right: 44px;
    cursor: pointer;
}

/* Empty select: show only the floating label (option text would overlap) */
.float-field--select:not(.float-field--filled):not(:focus-within) .float-field-control {
    color: transparent;
}

.float-field--select:not(.float-field--filled):not(:focus-within) .float-field-control option {
    color: var(--color-text);
}

/* Empty date: hide native dd.mm.yyyy under the centered label */
.float-field:not(.float-field--filled):not(:focus-within) input[type="date"].float-field-control {
    color: transparent;
}

.float-field:not(.float-field--filled):not(:focus-within) input[type="date"].float-field-control::-webkit-datetime-edit {
    color: transparent;
}

.float-field--select::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    width: 24px;
    height: 24px;
    transform: translateY(-50%);
    pointer-events: none;
    background-color: var(--color-icon);
    -webkit-mask: url("../assets/img/icons/angle-down.svg") center / contain no-repeat;
    mask: url("../assets/img/icons/angle-down.svg") center / contain no-repeat;
    -webkit-mask-source-type: alpha;
    mask-mode: alpha;
}

.float-field-label .float-field-optional {
    font-weight: 400;
    opacity: 0.7;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: inherit;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button,
input,
textarea,
select {
    font: inherit;
}

/* Auth screens – frameless, centered form column */
.login-container,
.register-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 48px 20px 32px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.auth-panel {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.login-container .float-field-control,
.register-container .float-field-control {
    font-size: 16px;
}

.login-container .float-field-label,
.register-container .float-field-label {
    font-size: 16px;
}

.auth-brand {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 32px;
    text-align: center;
    letter-spacing: -0.02em;
}

.login-container h2,
.register-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: #1d1d1f;
    letter-spacing: -0.02em;
}

.login-container .float-field,
.register-container .float-field {
    margin-bottom: 24px;
}

.login-container .btn,
.register-container .btn {
    margin-top: 8px;
    max-width: none;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9375rem;
    color: #6e6e73;
}

.auth-link {
    color: #1d1d1f;
    font-weight: 500;
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.terms {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9375rem;
    color: #6e6e73;
}

.terms a,
.terms .auth-link {
    color: #1d1d1f;
    font-weight: 500;
    text-decoration: none;
}

.terms a:hover,
.terms .auth-link:hover {
    text-decoration: underline;
}

.auth-link-muted {
    color: #6e6e73;
    font-weight: 400;
}

.terms .auth-link-muted:hover {
    color: #1d1d1f;
}

/* App container – Figma Overview */
.container {
    width: 100%;
    max-width: var(--app-max-width);
    padding: 0 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

body.has-bottom-nav .container {
    padding-bottom: 128px;
}

.header-container {
    display: grid;
    grid-template-columns: var(--icon-btn-size) 1fr auto;
    align-items: center;
    gap: 0 8px;
    min-height: var(--icon-btn-size);
}

/* Full page header overlays the list: pinned at top, solid white, content scrolls behind. */
.screen-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: auto;
    margin: 0 -16px;
    padding: 62px 16px 8px;
    background: #fff;
    transition: padding-bottom var(--header-motion);
}

.screen-header.has-large-title:not(.header-title-visible) {
    padding-bottom: 8px;
    transition: padding-bottom var(--header-motion-spring);
}

.screen-header.has-large-title.header-title-visible {
    padding-bottom: 8px;
}

.screen-header-toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-toolbar-height);
    margin: 0;
    padding: 0;
    background: #fff;
}

.screen-header-toolbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--header-motion);
}

.screen-header.has-large-title.header-title-visible .screen-header-toolbar::after {
    opacity: 1;
}

.screen-header-toolbar-start {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    min-width: var(--header-btn-size);
    min-height: var(--header-btn-size);
}

.screen-header-toolbar-end {
    position: relative;
    z-index: 1;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: var(--header-btn-size);
    min-height: var(--header-btn-size);
}

.screen-header-compact-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    margin: 0;
    max-width: min(56%, 220px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--header-compact-size);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 40px;
    color: #111;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--header-motion), transform var(--header-motion);
}

.screen-header.has-large-title.header-title-visible .screen-header-compact-title {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.screen-header.has-large-title:not(.header-title-visible) .screen-header-compact-title {
    transition: opacity var(--header-motion-spring), transform var(--header-motion-spring);
}

.screen-header-large {
    display: grid;
    grid-template-rows: 1fr;
    min-height: 0;
    position: relative;
    z-index: 0;
    overflow: hidden;
    transition: grid-template-rows var(--header-motion);
}

.screen-header.has-large-title:not(.header-title-visible) .screen-header-large {
    transition: grid-template-rows var(--header-motion-spring);
}

.screen-header.has-large-title.header-title-visible .screen-header-large {
    grid-template-rows: 0fr;
}

.screen-header-large > .screen-header-title {
    overflow: hidden;
    min-height: 0;
}

.screen-header-title {
    text-align: left;
    width: 100%;
    transform: translateY(0);
    opacity: 1;
    transition: transform var(--header-motion), opacity var(--header-motion);
}

.screen-header.has-large-title.header-title-visible .screen-header-title {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.screen-header.has-large-title:not(.header-title-visible) .screen-header-title {
    transition: transform var(--header-motion-spring), opacity var(--header-motion-spring);
}

.screen-header.is-resetting-title,
.screen-header.is-resetting-title .screen-header-large,
.screen-header.is-resetting-title .screen-header-title,
.screen-header.is-resetting-title .screen-header-compact-title,
.screen-header.is-resetting-title .screen-header-toolbar::after,
.screen-header.header-collapse-instant,
.screen-header.header-collapse-instant .screen-header-large,
.screen-header.header-collapse-instant .screen-header-title,
.screen-header.header-collapse-instant .screen-header-compact-title,
.screen-header.header-collapse-instant .screen-header-toolbar::after {
    transition: none;
}

.screen-header .add-button-circle,
.screen-header .profile-button,
.screen-header .header-back-btn {
    width: var(--header-btn-size);
    height: var(--header-btn-size);
}

.screen-header .add-button-circle {
    background: var(--icon-btn-bg-muted);
}

.screen-header .add-button-circle:hover {
    background: var(--icon-btn-bg-muted-hover);
}

.screen-header .add-button-plus {
    background-color: #111;
}

.header-back-btn {
    width: var(--header-btn-size);
    height: var(--header-btn-size);
    border: none;
    background: var(--icon-btn-bg-muted);
    border-radius: var(--icon-btn-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    padding: 0;
    transition: background 0.2s;
}

.header-back-btn:hover {
    background: var(--icon-btn-bg-muted-hover);
}

.overview-title {
    min-width: 0;
    min-height: var(--header-large-title-height);
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
    line-height: 32px;
    text-align: left;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-spacer,
.header-actions-spacer {
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    flex-shrink: 0;
    display: block;
}

.add-button-circle {
    /* alias of icon-btn--dark */
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border: none;
    border-radius: var(--icon-btn-radius);
    background: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.add-button-circle:hover {
    background: #333;
}

.add-button-circle:active {
    transform: scale(0.98);
}

.add-button-plus {
    width: var(--icon-size);
    height: var(--icon-size);
    background-color: #fff;
    -webkit-mask: url("../assets/img/icons/plus.svg") center / contain no-repeat;
    mask: url("../assets/img/icons/plus.svg") center / contain no-repeat;
    -webkit-mask-source-type: alpha;
    mask-mode: alpha;
}

.profile-button {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--icon-btn-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.2s;
}

.profile-button:hover {
    opacity: 0.9;
}

.profile-button .user-avatar {
    width: 100%;
    height: 100%;
}

.profile-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.output-section {
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.output-section-header {
    display: none;
}

.output-section-header.section-header--empty {
    display: none;
}

.output-section-title {
    font-weight: 400;
    color: #111;
}

.output-section-count {
    font-weight: 400;
    color: #797979;
}

.output-section-total {
    font-weight: 400;
    color: #797979;
    font-variant-numeric: tabular-nums;
}

.output-section .entry-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.output-section .entry-list.list-card {
    padding: 16px;
    gap: 16px;
    background: var(--color-surface-muted);
    border-radius: 8px;
    box-sizing: border-box;
}

.output-section .entry-list:empty:not(.is-loading) {
    display: none;
}

#expenses-list-root,
#ausgaben-list-root {
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-anchor: none;
}

.list-future-spacer {
    flex-shrink: 0;
    width: 100%;
    pointer-events: none;
}

.list-empty-present {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 400;
    line-height: normal;
    margin: 0;
}

#expenses-list-root.is-loading,
#ausgaben-list-root.is-loading {
    min-height: 120px;
}

#expenses-intro-text,
#ausgaben-intro-text,
#intro-text {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 400;
    line-height: normal;
    margin: 0;
}

.entry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s;
}

.entry-item:hover {
    opacity: 0.85;
}

.entry-item-icon {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border-radius: 12px;
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #111;
}

.entry-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.entry-item-title {
    font-size: 13px;
    font-weight: 400;
    color: #111;
    line-height: normal;
}

.entry-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-width: 0;
}

.entry-item-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 4px;
    border-radius: 2px;
    background: var(--color-text);
    color: #fff;
    font-size: 8px;
    font-weight: 400;
    letter-spacing: -0.32px;
    line-height: normal;
    white-space: nowrap;
}

.entry-item-space {
    flex-shrink: 0;
    max-width: 42%;
    font-size: 11px;
    font-weight: 500;
    color: #797979;
    line-height: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entry-item-category {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    font-weight: 500;
    color: #797979;
    line-height: normal;
}

.entry-item-category--needs-assignment {
    color: #b45309;
}

.entry-item--needs-category .entry-item-icon {
    filter: grayscale(0.2);
}

.entry-item-execution {
    display: none;
}

.entry-item-amount {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 400;
    color: #111;
    text-align: right;
    font-variant-numeric: tabular-nums;
    padding: 2px 0;
    border-radius: 4px;
}

.entry-item-amount.positive {
    background: var(--color-positive-bg);
    padding: 2px;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Bottom sheet modals (Trade Republic style) */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}

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

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

.modal.is-visible .modal-backdrop {
    opacity: 1;
}

.modal-sheet {
    position: relative;
    width: 100%;
    max-width: var(--app-max-width);
    /* Stable height so nested profile views don't jump */
    height: 80vh;
    min-height: 80vh;
    max-height: 90vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    /* Cover subpixel gap at bottom edge (dark backdrop hairline) */
    margin-bottom: -2px;
    padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px));
    background-clip: padding-box;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.modal.is-visible .modal-sheet {
    transform: translateY(0);
}

.modal.is-dragging .modal-sheet {
    transition: none;
}

.modal-drag-handle {
    flex-shrink: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

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

.modal-drag-bar {
    display: block;
    width: 40px;
    height: 4px;
    background: #d2d2d7;
    border-radius: 2px;
}

.modal-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 32px;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Unified modal header bar (Add/Edit modals and profile sub-views) */
.modal-header-bar,
.profile-subview-header {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: var(--header-toolbar-height);
    margin: 0 -16px 0;
    flex-shrink: 0;
    padding: 0 16px;
    background: #fff;
}

.modal-header-bar::after,
.profile-subview-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--header-motion);
}

.modal-header-bar.has-large-title.header-title-visible::after,
.profile-subview-header.has-large-title.header-title-visible::after {
    opacity: 1;
}

.modal-header-spacer,
.profile-header-spacer {
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    flex-shrink: 0;
}

/* Right slot: same width as left for true center alignment */
.modal-header-right,
.profile-header-right {
    position: relative;
    z-index: 1;
    width: var(--icon-btn-size);
    min-width: var(--icon-btn-size);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.modal-header-bar > .header-back-btn,
.modal-header-bar > .modal-header-spacer,
.profile-subview-header > .header-back-btn,
.profile-subview-header > .modal-header-spacer {
    position: relative;
    z-index: 1;
}

.modal-header-bar--with-action .modal-header-right,
.modal-header-bar--with-close .modal-header-right,
.profile-subview-header--with-action .profile-header-right,
.profile-subview-header--with-close .profile-header-right {
    width: auto;
    min-width: var(--icon-btn-size);
}

.modal-header-title,
.profile-subview-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    margin: 0;
    max-width: min(52%, 240px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: var(--header-compact-size);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 40px;
    color: var(--color-text);
    transition: opacity var(--header-motion), transform var(--header-motion);
    pointer-events: none;
}

/* iOS large title: header title hidden until scrolled */
.modal-header-bar.has-large-title .modal-header-title,
.profile-subview-header.has-large-title .profile-subview-title,
.profile-subview-header.has-large-title .modal-header-title {
    opacity: 0;
}

.modal-header-bar.has-large-title.header-title-visible .modal-header-title,
.profile-subview-header.has-large-title.header-title-visible .profile-subview-title,
.profile-subview-header.has-large-title.header-title-visible .modal-header-title {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header-bar.has-large-title:not(.header-title-visible) .modal-header-title,
.profile-subview-header.has-large-title:not(.header-title-visible) .modal-header-title,
.profile-subview-header.has-large-title:not(.header-title-visible) .profile-subview-title {
    transition: opacity var(--header-motion-spring), transform var(--header-motion-spring);
}

.modal-header-bar.header-collapse-instant,
.modal-header-bar.header-collapse-instant .modal-header-title,
.modal-header-bar.header-collapse-instant::after,
.profile-subview-header.header-collapse-instant,
.profile-subview-header.header-collapse-instant .modal-header-title,
.profile-subview-header.header-collapse-instant::after {
    transition: none;
}

/* Close / muted icon actions — prefer .icon-btn; keep aliases */
.modal-header-action,
.profile-close-btn,
.profile-header-action-add {
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    flex-shrink: 0;
    border: none;
    border-radius: var(--icon-btn-radius);
    background: var(--icon-btn-bg-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--color-text);
}

.modal-header-action:hover,
.profile-close-btn:hover,
.profile-header-action-add:hover {
    background: var(--icon-btn-bg-muted-hover);
}

.modal-header-action-icon,
.profile-close-icon {
    display: block;
}

.profile-header-action-add {
    font-size: 1.5rem;
}

.modal-header-bar .modal-header-pills {
    width: 100%;
    position: relative;
    z-index: 1;
}

.modal-header-bar.has-large-title .modal-header-pills ~ .modal-header-title {
    display: none;
}

.modal-sheet--picker {
    max-height: 70vh;
}

.modal-sheet--picker .modal-content {
    padding-bottom: 40px;
}

.btn-pill.btn--loading {
    opacity: 0.6;
    pointer-events: none;
}

.modal-large-title {
    font-size: 24px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
    line-height: 32px;
    min-height: var(--header-large-title-height);
    display: flex;
    align-items: center;
    margin: 0 0 16px;
    padding: 0;
}

[hidden] {
    display: none !important;
}

/* Disable background scroll when any modal is open */
html.no-scroll {
    overflow: hidden !important;
    height: 100%;
}

body.no-scroll {
    overflow: hidden !important;
    height: 100%;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
}



.modal-content .btn {
    max-width: none;
}

.breakdown-container {
    background: #f6f6f6;
    color: #111;
    padding: 16px;
    border-radius: 16px;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 148px;
    box-sizing: border-box;
}

.breakdown-container[hidden],
.output-section[hidden] {
    display: none !important;
}

.breakdown-header {
    font-size: 12px;
    font-weight: 400;
    line-height: normal;
}

.breakdown-title {
    color: #111;
}

.breakdown-subtitle {
    color: #797979;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 21px;
    font-size: 13px;
    font-weight: 500;
    color: #111;
}

.breakdown-amount {
    font-size: 14px;
    font-weight: 400;
    color: #111;
    font-variant-numeric: tabular-nums;
    min-width: 5.5em;
    text-align: right;
}

.breakdown-amount--positive {
    background: #e3f893;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Profile & Settings modal – view switching */
.modal-content-profile {
    max-width: none;
    max-height: none;
    height: 100%;
    overflow: hidden;
    overflow-x: hidden;
    padding: 0 16px 24px;
    position: relative;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

.profile-view {
    display: none;
    flex-direction: column;
    gap: 0;
    padding-top: 0;
    margin: 0 auto;
    width: 100%;
}

/* Main settings list: Figma width, centered */
#profile-view-settings {
    max-width: none;
}

#profile-view-settings .profile-view-body {
    max-width: 343px;
    margin: 0 auto;
    width: 100%;
}

.profile-view.profile-view-visible {
    display: flex;
    animation: profileViewFadeIn 0.22s ease-out;
}

@keyframes profileViewFadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Settings view – close button aliases; prefer .icon-btn--close */
.profile-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1;
}

.profile-close-btn--inline {
    position: static;
    top: auto;
    right: auto;
}

.profile-close-icon {
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' transform='rotate(45)'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E") no-repeat center;
    background-size: 24px 24px;
}

/* Settings view – profile header (avatar + name) */
.profile-header {
    --profile-collapse: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transform-origin: center top;
    opacity: calc(1 - min(calc(var(--profile-collapse) / 0.6), 1));
    transform: scale(calc(1 - min(calc(var(--profile-collapse) / 0.6), 1) * 0.18));
    padding-top: 8px;
}

.profile-avatar-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border: 2.5px solid var(--color-focus);
    border-radius: 141px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    appearance: none;
    -webkit-appearance: none;
    transition: opacity 0.2s, transform 0.15s ease;
}

.profile-avatar-wrap:hover {
    opacity: 0.92;
}

.profile-avatar-wrap:active {
    transform: scale(0.98);
}

.profile-avatar-edit {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 22px;
    height: 22px;
    border-radius: 141px;
    background: var(--color-focus);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.profile-avatar-edit .icon {
    width: 12px;
    height: 12px;
    background-color: #fff;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 100px;
    overflow: hidden;
    background: #f6f6f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    line-height: 1;
    color: #202020;
    border: none;
    padding: 0;
}

.profile-avatar--button {
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s ease;
}

.profile-avatar--button:hover {
    opacity: 0.92;
}

.profile-avatar--button:active {
    transform: scale(0.98);
}

.profile-avatar--emoji {
    font-size: 42px;
    font-weight: 400;
}

.profile-avatar--initials {
    font-size: 36px;
    font-weight: 600;
}

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

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    overflow: hidden;
    background: #f6f6f6;
    color: #202020;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
    vertical-align: middle;
}

.user-avatar--sm {
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.user-avatar--md {
    width: 48px;
    height: 48px;
    font-size: 18px;
}

.user-avatar--lg {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.user-avatar--xl {
    width: 112px;
    height: 112px;
    font-size: 42px;
}

.user-avatar--image img,
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar--emoji {
    font-weight: 400;
}

.user-avatar--sm.user-avatar--emoji {
    font-size: 16px;
}

.user-avatar--md.user-avatar--emoji {
    font-size: 22px;
}

.user-avatar--lg.user-avatar--emoji {
    font-size: 34px;
}

.user-avatar--xl.user-avatar--emoji {
    font-size: 52px;
}

.account-avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.btn-link {
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: #007aff;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.btn-link:hover {
    text-decoration: underline;
}

.avatar-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.avatar-editor-preview-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
}

.avatar-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-editor-panel[hidden] {
    display: none !important;
}

.avatar-color-swatches {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.avatar-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 100px;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.avatar-color-swatch.is-selected {
    border-color: #202020;
}

.avatar-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

.avatar-emoji-btn {
    appearance: none;
    border: 1px solid transparent;
    background: #f6f6f6;
    border-radius: 12px;
    aspect-ratio: 1;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.avatar-emoji-btn.is-selected {
    border-color: #202020;
    background: #ececec;
}

.profile-display-name {
    font-size: 14px;
    font-weight: 700;
    color: #111;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    margin: 0;
}

.profile-handle {
    font-size: 10px;
    font-weight: 400;
    color: #111;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    margin: 0;
}

/* Settings view – menu sections (Figma List Item) */
.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-menu-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-menu-section-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.48px;
    color: var(--color-text);
    margin: 0;
    line-height: normal;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 0;
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.2s;
    background: transparent;
}

.profile-menu-item:hover {
    opacity: 0.85;
    background: transparent;
}

.profile-menu-leading {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.profile-menu-icon {
    flex-shrink: 0;
    width: var(--icon-size);
    height: var(--icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-icon);
}

.profile-menu-icon svg,
.profile-menu-icon .icon {
    width: var(--icon-size);
    height: var(--icon-size);
}

.profile-menu-label {
    font-size: 14px;
    font-weight: 400;
    color: #111;
    text-align: left;
    line-height: normal;
}

.profile-menu-chevron {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.profile-menu-chevron svg,
.profile-menu-chevron .icon {
    width: 24px;
    height: 24px;
}

.profile-menu-item--toggle {
    cursor: default;
}

.profile-menu-item--toggle:hover {
    opacity: 1;
    background: transparent;
}

.profile-menu-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    justify-content: center;
}

.profile-menu-sublabel {
    font-size: 11px;
    font-weight: 400;
    color: #797979;
    line-height: 16px;
    margin: 0;
}

/* Toggle (Figma: 56×28, track + handle) */
.profile-toggle {
    flex-shrink: 0;
    width: 56px;
    height: 28px;
    border-radius: 1000px;
    background: #d9d9d9;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.profile-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.profile-toggle-track {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 1000px;
    position: relative;
}

.profile-toggle-track::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 1000px;
    background: #fff;
    transition: transform 0.2s;
}

.profile-toggle:has(.profile-toggle-input:checked) {
    background: #34c759;
}

.profile-toggle:has(.profile-toggle-input:checked) .profile-toggle-track::after {
    transform: translateX(28px);
}

/* Menu Item (Figma) — form / settings rows with value + trailing control */
.menu-item-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.menu-item-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    border-radius: 8px;
    background: var(--menu, #f6f6f6);
    width: 100%;
    position: relative;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 48px;
    padding: 12px 16px;
    box-sizing: border-box;
    background: var(--menu, #f6f6f6);
    border-radius: 8px;
    width: 100%;
    border: none;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: default;
}

.menu-item-group > .menu-item {
    border-radius: 0;
}

button.menu-item,
.menu-item[role="button"] {
    cursor: pointer;
}

.menu-item:disabled,
.menu-item.is-disabled {
    cursor: default;
    opacity: 1;
}

.menu-item--switch {
    min-height: 52px;
}

.menu-item-leading {
    display: flex;
    flex: 1;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.menu-item-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.menu-item-icon .icon {
    width: 24px;
    height: 24px;
}

.menu-item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    justify-content: center;
}

.menu-item-label {
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: var(--menu-foreground, #202020);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.menu-item-desc {
    font-size: 11px;
    font-weight: 400;
    line-height: normal;
    color: #111;
    opacity: 0.4;
    margin: 0;
}

.menu-item-trailing {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0;
}

.menu-item-value {
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: var(--menu-foreground, #202020);
    white-space: nowrap;
}

.menu-item--nav .menu-item-value {
    color: #111;
}

.menu-item--dropdown-none .menu-item-value,
.menu-item-value--muted {
    opacity: 0.5;
}

.menu-item-chevron,
.menu-item-direction {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.menu-item-chevron .icon,
.menu-item-direction .icon {
    width: 24px;
    height: 24px;
}

.menu-item--indent .menu-item-leading {
    padding-left: 32px;
}

.menu-item-group--transfer {
    gap: 0;
}

.menu-item-group--transfer .menu-item-swap {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    pointer-events: none;
    z-index: 1;
}

.menu-item-group--transfer .menu-item-swap .icon {
    width: 24px;
    height: 24px;
}

.entry-form-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.entry-form-fields .float-field {
    margin-bottom: 0;
}

.entry-form-fields .error-message:empty {
    display: none;
    margin: 0;
    min-height: 0;
}

.modal-header-pills {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 56px;
    gap: 8px;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    max-width: 400px;
    height: 32px;
    padding: 6px 12px;
    border-radius: 1000px;
    border: 2px solid var(--colors-border-default, #f0f0f0);
    background: var(--colors-tone-territary, #f6f6f6);
    color: #111;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    cursor: pointer;
    font-family: inherit;
}

.btn-pill:hover {
    opacity: 0.85;
}

.btn-pill:disabled {
    opacity: 0.5;
    cursor: default;
}

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

/* Sub-views – back uses .header-back-btn (alias kept for older markup) */
.profile-back-btn {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--icon-btn-radius);
    transition: background 0.2s;
    color: var(--color-text);
}

.profile-back-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.profile-back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
}

.profile-back-icon svg {
    width: 24px;
    height: 24px;
}

.profile-view-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.profile-placeholder {
    font-size: 14px;
    color: #797979;
    margin: 0;
}

/* Sub-view header with right action (close or add) – title stays centered */
.modal-header-bar--with-close,
.modal-header-bar--with-action,
.profile-subview-header--with-close,
.profile-subview-header--with-action {
    justify-content: space-between;
}

/* Kategorien view – large title aliases .modal-large-title */
.categories-title {
    /* prefer .modal-large-title */
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--icon-btn-size);
}

.category-row-icon {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border-radius: 12px;
    background: #f6f6f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #111;
}

.category-row-icon--shared {
    color: #797979;
}

.category-row-default-tag {
    font-weight: 500;
    color: #797979;
}

.category-row-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-row-label {
    font-size: 13px;
    font-weight: 500;
    color: #111;
    line-height: normal;
}

.category-row-sublabel {
    font-size: 11px;
    font-weight: 500;
    color: #797979;
    line-height: normal;
}

.category-row-delete {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border: none;
    border-radius: var(--icon-btn-radius);
    background: var(--icon-btn-bg-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.category-row-delete:hover {
    background: var(--icon-btn-bg-muted-hover);
}

.category-row-delete .icon,
.category-row-delete .icon--trash {
    width: var(--icon-size);
    height: var(--icon-size);
    color: var(--color-icon);
}

.category-row-delete svg {
    width: 24px;
    height: 24px;
    color: #111;
}

/* Input with icon (Kategorie bearbeiten) */
.input-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 12px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s;
}

.input-with-icon:focus-within {
    border-color: #2f51eb;
}

.input-with-icon-icon {
    position: relative;
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border-radius: 12px;
    background: #f6f6f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.input-with-icon-edit {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 100px;
    background: #2f51eb;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.input-with-icon-edit svg {
    width: 10px;
    height: 10px;
    color: #fff;
}

.input-with-icon-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.input-with-icon-label {
    font-size: 12px;
    color: #d6d6d6;
    line-height: normal;
}

.input-with-icon-input {
    border: none;
    padding: 0;
    font-size: 14px;
    color: #111;
    background: transparent;
    width: 100%;
}

.input-with-icon-input::placeholder {
    color: #d6d6d6;
}

.input-with-icon-input:focus {
    outline: none;
}

/* Chips (Empfehlungen) */
.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border: none;
    border-radius: 32px;
    background: #111;
    color: #f6f6f6;
    font-size: 14px;
    letter-spacing: -0.56px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.category-chip:hover {
    opacity: 0.9;
}

/* Footer button (Weiter) – round arrow right */
.btn-next {
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border: none;
    border-radius: var(--icon-btn-radius);
    background: #111;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.btn-next:hover {
    background: #333;
}

.btn-next svg,
.btn-next .icon {
    width: var(--icon-size);
    height: var(--icon-size);
    color: #fff;
}

/* Category edit view layout */
.category-edit-footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.category-edit-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 8px;
}

.profile-section {
    margin-bottom: 24px;
}

.profile-section:last-child {
    margin-bottom: 0;
}

/* .profile-section-title → use .section-title.section-title--caps */

.profile-info {
    margin-bottom: 4px;
}

.profile-label {
    display: block;
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 4px;
}

.profile-email {
    font-size: 1rem;
    font-weight: 500;
    color: #333;
}

.profile-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-row .float-field {
    margin-bottom: 0;
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.profile-message {
    font-size: 0.85rem;
    margin-top: 4px;
    min-height: 1.2em;
}

.profile-message.success {
    color: var(--color-success);
}

.profile-message.error {
    color: var(--color-danger);
}

.profile-section-logout {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* --- Spaces picker (Wallet-style) — same shell as dashboard (white bg) --- */
.spaces-screen,
.home-screen,
.expenses-screen {
    background: #fff;
}

.home-screen.container {
    gap: 0;
}

.home-highlights {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.home-highlights::-webkit-scrollbar {
    display: none;
}

.home-highlight {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 68px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.home-highlight-ring {
    box-sizing: border-box;
    width: 68px;
    height: 68px;
    padding: 4px;
    border: 2px solid var(--color-surface-muted);
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-highlight .user-avatar {
    width: 56px;
    height: 56px;
    font-size: 22px;
}

.home-highlight .user-avatar--emoji {
    font-size: 26px;
}

.home-highlight-name {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 400;
    line-height: normal;
    text-align: center;
    color: var(--color-text);
    opacity: 0.5;
}

.home-highlight-add {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text);
}

.home-highlight-add-disc {
    width: 56px;
    height: 56px;
    border-radius: 100px;
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.home-highlight-add:hover .home-highlight-add-disc {
    background: var(--icon-btn-bg-muted-hover);
}

.home-highlight:focus-visible,
.home-highlight-add:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 12px;
}

.spaces-home-title {
    text-align: left;
}

.spaces-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 8px;
    /* Figma View 457:14005: 16px padding + 40px avatars + radius clearance */
    --wallet-card-peek: 69px;
}

.spaces-stack--grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.spaces-layout-setting {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 0;
}

.spaces-layout-setting-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 0;
    min-height: 56px;
}

.layout-segment {
    position: relative;
    display: flex;
    gap: 0;
    padding: 3px;
    margin: 0 0 20px;
    background: #f6f6f6;
    border-radius: 10px;
}

.layout-segment-pill {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    z-index: 0;
    transition:
        transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
        width 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform, width;
}

.spaces-layout-setting .layout-segment {
    margin: 0;
    background: #fff;
}

.profile-section > .layout-segment {
    margin: 0 0 12px;
}

.dashboard-view-segment.layout-segment {
    margin: 0;
}

.dashboard-tabs {
    width: 100%;
    padding-top: 8px;
}

.dashboard-tabs .layout-segment {
    margin: 0;
    width: 100%;
    background: #f6f6f6;
    border-radius: 10px;
}

.layout-segment-btn {
    position: relative;
    z-index: 1;
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #797979;
    cursor: pointer;
    transition: color 0.2s ease;
}

.layout-segment-btn.is-active {
    background: transparent;
    color: #111;
    box-shadow: none;
}

.layout-segment-btn:focus-visible {
    outline: 2px solid #2f51eb;
    outline-offset: 1px;
}

.space-picker {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    margin: 4px 0 8px;
    padding: 2px 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
}

.space-picker[hidden] {
    display: none;
}

.space-picker::-webkit-scrollbar {
    display: none;
}

.space-picker-tile {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 180px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--space-picker-color, #d2d2d7) 45%, #d2d2d7);
    border-radius: 12px;
    background: color-mix(in srgb, var(--space-picker-color, #f6f6f6) 28%, #fff);
    color: #111;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.32px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.space-picker-tile-swatch {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--space-picker-color, #d2d2d7);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.space-picker-tile-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.space-picker-tile.is-selected {
    background: var(--space-picker-color, #f6f6f6);
    color: #111;
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.space-picker-tile:focus-visible {
    outline: 2px solid #2f51eb;
    outline-offset: 1px;
}

.spaces-empty {
    color: #666;
    text-align: center;
    font-size: 15px;
    margin-top: 24px;
}

/* Wallet / square space cards (Figma Single Space: 370×225 wallet, 288×288 square) */
.wallet-card {
    position: relative;
    width: 100%;
    aspect-ratio: 370 / 225;
    border-radius: 16px;
    background: var(--wallet-card-bg, #d0f7ff);
    color: #111;
    cursor: pointer;
    outline: none;
    overflow: hidden;
    transition: transform 0.15s ease;
    margin: 0;
    z-index: 0;
}

/*
 * Stacked wallet (Figma View 457:14005): cards are 225 tall with -156px overlap → 69px peek.
 * Percentage margins are relative to WIDTH; card height is 225/370 of that width, so
 * margin-bottom = peek - height keeps a header-only strip on mobile and desktop.
 */
.spaces-stack:not(.spaces-stack--grid) .wallet-card,
.spaces-stack--stack .wallet-card {
    margin-bottom: calc(var(--wallet-card-peek, 69px) - (225 / 370 * 100%));
}

.spaces-stack:not(.spaces-stack--grid) .wallet-card:last-child,
.spaces-stack--stack .wallet-card:last-child {
    margin-bottom: 0;
}

.spaces-stack--grid .wallet-card {
    margin-bottom: 0;
    aspect-ratio: 1 / 1;
    z-index: auto;
}

.wallet-card:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

.wallet-card:active {
    transform: scale(0.99);
}

.wallet-card--loading {
    background: #f2f2f2;
    cursor: default;
}

.wallet-card--loading:active {
    transform: none;
}

/*
 * Wallet (stacked): title | avatars on top row, stats below.
 * Square (grid): title + stats on top block, avatars bottom-left.
 */
.wallet-card-inner {
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "title members"
        "stats stats";
    column-gap: 16px;
    row-gap: 16px;
    align-content: start;
    min-height: 0;
}

.spaces-stack--grid .wallet-card-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "title"
        "stats"
        "members";
    align-content: stretch;
    justify-content: space-between;
}

.wallet-card-header {
    grid-area: title;
    min-width: 0;
    display: flex;
    align-items: center;
}

.wallet-card-title {
    display: block;
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: normal;
    color: #000;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spaces-stack:not(.spaces-stack--grid) .wallet-card:last-child .wallet-card-title,
.spaces-stack--stack .wallet-card:last-child .wallet-card-title,
.spaces-stack--grid .wallet-card-title {
    font-size: 20px;
}

.wallet-card-stats {
    grid-area: stats;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.wallet-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.wallet-card-row-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    color: #111;
}

.wallet-card-row-value {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
    color: #111;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wallet-card-row-value--positive {
    background: var(--color-positive-bg, #e3f893);
    border-radius: 4px;
    padding: 2px;
}

.wallet-card-members {
    grid-area: members;
    flex-shrink: 0;
    align-self: start;
}

.spaces-stack--grid .wallet-card-members {
    align-self: end;
    justify-self: start;
}

.wallet-card-member-avatars {
    display: flex;
    flex-direction: row;
    align-items: center;
    isolation: isolate;
}

.wallet-card-member-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    border: 2px solid var(--color-surface-muted, #f6f6f6);
    border-radius: 100px;
    overflow: hidden;
    background: #f6f6f6;
    color: #202020;
    flex-shrink: 0;
}

.wallet-card-member-avatar + .wallet-card-member-avatar {
    margin-left: -20px;
}

.wallet-card-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Default profile mark (same as .profile-button) when no photo */
.wallet-card-member-avatar--profile {
    background: #202020;
    color: #fff;
}

.wallet-card-member-avatar--profile img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.wallet-card-member-avatar--placeholder {
    font-size: 16px;
    font-weight: 500;
    line-height: 12px;
}

.wallet-card-member-avatar--emoji {
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
}

.wallet-card-member-avatar--skeleton {
    background: #e0e0e0;
}

/* Loading skeletons */
.wallet-card-skeleton {
    display: block;
    background: #e0e0e0;
    border-radius: 4px;
    flex-shrink: 0;
}

.wallet-card-skeleton--title {
    width: 100px;
    height: 22px;
    border-radius: 6px;
}

.wallet-card-skeleton--label {
    width: 80px;
    height: 14px;
}

.wallet-card-skeleton--amount {
    width: 72px;
    height: 18px;
    margin-left: auto;
}

/* Personen / Spaces settings rows */
.person-row-avatar {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    border-radius: 12px;
    object-fit: cover;
}

.person-row-avatar--initials,
.person-row-avatar--emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
    color: #202020;
}

.person-row-avatar--emoji {
    font-weight: 400;
}

.person-row-icon-placeholder {
    font-size: 18px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.row-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #f6f6f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #111;
}

.row-action-btn:hover:not(:disabled) {
    background: #ebebeb;
}

.row-action-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.people-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.people-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f6f6f6;
    cursor: pointer;
    min-width: 0;
}

.people-picker-checkbox {
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    background: #f6f6f6;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.people-picker-checkbox:checked {
    background: #fff;
    border-color: #2f51eb;
}

.people-picker-checkbox:checked::before {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 2px;
    background: #2f51eb;
}

.people-picker-checkbox:checked::after {
    content: "";
    position: absolute;
    left: -2px;
    top: -2px;
    width: 24px;
    height: 24px;
    background-color: #fff;
    -webkit-mask-image: url("../assets/img/icons/check.svg");
    mask-image: url("../assets/img/icons/check.svg");
    -webkit-mask-size: 24px 24px;
    mask-size: 24px 24px;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

.people-picker-checkbox:focus-visible {
    outline: 2px solid var(--color-focus, #2f51eb);
    outline-offset: 2px;
}

.people-picker-name {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: #111;
    line-height: 1.3;
    text-align: left;
}

.person-edit-account-note {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.45;
    color: #797979;
}

.space-settings-row {
    cursor: pointer;
}

/* App shell + screen transitions */
#app-shell {
    position: relative;
    width: 100%;
    max-width: var(--app-max-width);
    margin: 0 auto;
    min-height: 100vh;
}

#app-shell > .app-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.app-screen.screen-entering,
.app-screen.screen-leaving {
    will-change: transform, opacity;
}

.app-screen {
    display: none;
    width: 100%;
}

.app-screen.screen-active,
.app-screen.screen-entering,
.app-screen.screen-leaving {
    display: flex;
    flex-direction: column;
}

.app-screen.screen-entering {
    z-index: 2;
}

.app-screen.screen-leaving {
    z-index: 1;
}

.app-screen.screen-active:not(.screen-leaving) {
    z-index: 1;
}

#auth-container.app-screen.screen-active,
#auth-container.app-screen.screen-entering,
#auth-container.app-screen.screen-leaving {
    display: block;
}

#app-shell > .app-screen:not(.screen-active):not(.screen-entering):not(.screen-leaving) {
    visibility: hidden;
    pointer-events: none;
}

/* Global loading overlay (login → app) */
.app-loading {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.app-loading--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #ebebeb;
    border-top-color: #202020;
    border-radius: 50%;
    animation: appLoadingSpin 0.7s linear infinite;
}

@keyframes appLoadingSpin {
    to { transform: rotate(360deg); }
}

/* Skeleton placeholders */
@keyframes skeletonShimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton-shimmer {
    background: linear-gradient(90deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.15) 100%);
    background-size: 200px 100%;
    animation: skeletonShimmer 1.2s ease-in-out infinite;
    border-radius: 8px;
}

.wallet-card--loading .wallet-card-row {
    justify-content: space-between;
}

.breakdown-container.is-loading .breakdown-amount {
    color: transparent;
    position: relative;
    min-width: 64px;
    display: inline-block;
}

.breakdown-container.is-loading .breakdown-amount::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f0f0 0%, #e4e4e4 50%, #f0f0f0 100%);
    background-size: 200px 100%;
    animation: skeletonShimmer 1.2s ease-in-out infinite;
}

.entry-list.is-loading {
    min-height: 120px;
}

/* Profile sub-views: stack for GSAP transitions */
.modal-content-profile {
    position: relative;
}

.modal-content-profile > .profile-view {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background: #fff;
    animation: none;
    min-height: 0;
}

.modal-content-profile > .profile-view.profile-view-visible {
    position: relative;
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .modal-backdrop {
        backdrop-filter: none;
    }

    .app-loading-spinner {
        animation: none;
    }

    .skeleton-shimmer,
    .breakdown-container.is-loading .breakdown-amount::after {
        animation: none;
    }

    .profile-view.profile-view-visible {
        animation: none;
    }

    .screen-header,
    .screen-header .screen-header-large,
    .screen-header .screen-header-title,
    .screen-header .screen-header-compact-title,
    .screen-header-toolbar::after,
    .modal-header-bar,
    .modal-header-bar .modal-header-title,
    .modal-header-bar::after,
    .profile-header {
        transition: none !important;
    }

    .wallet-card {
        transition: none;
    }
}

/* Community + shared spaces — badge styles live on .badge-shared / .badge-shared--on-card */

.community-search-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.community-search-controls .float-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.community-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.community-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.community-result-row .category-row-content {
    flex: 1;
    min-width: 0;
}

.community-action-btn {
    width: auto;
    max-width: none;
    min-width: 0;
    flex-shrink: 0;
    margin-top: 0;
}

.community-meta {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

.vergleich-peer-teaser {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
}

.vergleich-peer-teaser[hidden] {
    display: none;
}

.vergleich-peer-teaser-title {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
}

.vergleich-peer-teaser-value {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.vergleich-peer-teaser-sub {
    margin: 6px 0 0;
    font-size: 13px;
    color: #888;
}

.vergleich-sort-segment {
    margin-top: 10px;
}

.vergleich-ranking-list {
    margin-top: 8px;
}

.vergleich-rank-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
}

.vergleich-rank-row.is-self {
    background: rgba(0, 0, 0, 0.02);
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
    border-radius: 8px;
}

.vergleich-rank-num {
    flex-shrink: 0;
    width: 28px;
    font-size: 15px;
    font-weight: 600;
    color: #888;
    padding-top: 2px;
}

.vergleich-rank-main {
    flex: 1;
    min-width: 0;
}

.vergleich-rank-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.vergleich-rank-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    color: #666;
}

.vergleich-rank-stats strong {
    font-weight: 600;
    color: #222;
}

.friend-finance-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friend-finance-card {
    padding: 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
}

.friend-finance-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.friend-finance-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.friend-finance-stat:first-child {
    padding-top: 0;
}

.friend-finance-stat-label {
    font-size: 14px;
    color: #666;
}

.friend-finance-stat-value {
    font-size: 16px;
    font-weight: 600;
}

.friend-finance-private {
    margin: 0;
    padding: 24px 8px;
    text-align: center;
    color: #888;
    font-size: 15px;
}

.community-friend-tap {
    cursor: pointer;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    text-align: left;
    font: inherit;
    color: inherit;
}

#username-gate-modal .modal-scroll {
    padding: 0 20px 28px;
}

#username-gate-modal .btn {
    margin-top: 16px;
    width: 100%;
    max-width: none;
}

/* Floating bottom navigation (Figma Navigation 618:3490) */
.bottom-nav {
    display: none;
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 30;
    pointer-events: none;
}

.bottom-nav.is-visible {
    display: flex;
}

.bottom-nav[aria-hidden="true"] .bottom-nav-bar {
    pointer-events: none;
}

.bottom-nav-bar {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
    border-radius: 1000px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.bottom-nav-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-pill {
    position: absolute;
    top: 0;
    left: 0;
    width: 64px;
    height: 40px;
    border-radius: 1000px;
    background: #fff;
    pointer-events: none;
    z-index: 0;
    transform: translateX(0);
    transition:
        transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
        width 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform, width;
}

.bottom-nav-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 1000px;
    color: #e5e5e5;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .icon {
    width: var(--icon-size);
    height: var(--icon-size);
}

.bottom-nav-item.is-active {
    color: var(--color-icon);
}

.bottom-nav-item:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav-pill {
        transition: none;
    }

    .bottom-nav {
        transition: none;
    }
}


