:root {
    --font-sans: "Inter", -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;
}

*,
*::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 – clean finance-style login/register */
.login-container,
.register-container {
    width: 100%;
    max-width: 440px;
    margin: 24px auto;
    padding: 48px 40px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

@media (max-width: 520px) {
    .login-container,
    .register-container {
        margin-left: 20px;
        margin-right: 20px;
        padding: 40px 24px;
    }
}

.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;
}

.input-group {
    text-align: left;
    margin-bottom: 24px;
}

.input-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: #6e6e73;
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    min-height: 64px;
    padding: 12px 16px;
    font-size: 14px;
    color: #111;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.2s;
}

.input-group input::placeholder {
    color: #d6d6d6;
    font-size: 12px;
}

.input-group input:focus {
    outline: none;
    border-color: #2f51eb;
}

.continue-button {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 0;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: #1d1d1f;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.continue-button:hover {
    background: #424245;
}

.continue-button:active {
    transform: scale(0.99);
}

.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: 480px;
    padding: 62px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.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);
}

/* Two-row screen header: toolbar above, title below (left-aligned) */
.screen-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.screen-header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--icon-btn-size);
}

.screen-header-toolbar-start {
    display: flex;
    align-items: center;
    min-width: var(--icon-btn-size);
    min-height: var(--icon-btn-size);
}

.screen-header-toolbar-end {
    margin-left: auto;
}

.screen-header-title {
    text-align: left;
    width: 100%;
}

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

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

.overview-title {
    min-width: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
    line-height: normal;
    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 {
    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: 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='white' stroke-width='2' stroke-linecap='round'%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;
}

.profile-button {
    flex-shrink: 0;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
    padding: 0;
    background: #202020;
    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-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: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 12px;
    line-height: normal;
    color: #111;
}

.output-section-header:not(:first-of-type) {
    margin-top: 8px;
}

.output-section-header.section-header--empty {
    visibility: hidden;
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 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;
}

.entry-list + .output-section-header {
    margin-top: 0;
}

.entry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    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: #f6f6f6;
    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: 500;
    color: #111;
    line-height: normal;
}

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

.entry-item-execution {
    font-size: 11px;
    font-weight: 500;
    color: #797979;
    line-height: normal;
}

.input-label-optional {
    font-weight: 400;
    color: #797979;
}

.entry-item-amount {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 400;
    color: #111;
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 4.5em;
}

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

#intro-text {
    color: #797979;
    font-size: 0.95rem;
    margin: 0;
}

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

.type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.type-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6e6e73;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    cursor: pointer;
    background: #fff;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.type-tab.active {
    background: #1d1d1f;
    color: #fff;
    border-color: #1d1d1f;
}

.type-tab:not(.active):hover {
    background: #f5f5f7;
    border-color: #1d1d1f;
}

.delete-button {
    color: #c53030;
    background: transparent;
    border: 1px solid #c53030;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s, color 0.2s;
}

.delete-button:hover {
    background: #c53030;
    color: #fff;
}

/* 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;
}

.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: 480px;
    min-height: 50vh;
    max-height: 90vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.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: 12px 16px 32px;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Unified modal header bar (Add/Edit modals and profile sub-views) */
.modal-header-bar,
.profile-subview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    margin-bottom: 8px;
    flex-shrink: 0;
    padding: 0 4px;
}

.modal-header-bar {
    padding: 0 8px;
}

.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 {
    width: var(--icon-btn-size);
    min-width: var(--icon-btn-size);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header-title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0;
    min-width: 0;
    transition: opacity 0.2s ease;
}

/* 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 {
    opacity: 0;
    pointer-events: none;
}

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

.modal-header-action {
    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: #111;
}

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

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

/* Large title (headline) in scrollable content – iOS style */
.modal-large-title {
    font-size: 28px;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
    margin: 0 0 20px 0;
    padding: 0;
}

/* 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 input:not([type="checkbox"]):not([type="radio"]),
.modal-content select {
    width: 100%;
    min-height: 64px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    color: #111;
    background: #fff;
    transition: border-color 0.2s;
}

.modal-content input:not([type="checkbox"]):not([type="radio"])::placeholder {
    color: #d6d6d6;
    font-size: 12px;
}

.modal-content input:not([type="checkbox"]):not([type="radio"]):focus,
.modal-content select:focus {
    outline: none;
    border-color: #2f51eb;
}

.modal-content button.modal-button {
    color: #fff;
    background: #1d1d1f;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-content button.modal-button:hover {
    background: #424245;
}

.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-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: 440px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 16px 42px;
    position: relative;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

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

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

.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 (Figma: circle top-right) */
.profile-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    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;
    z-index: 1;
    transition: background 0.2s;
}

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

.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 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 100px;
    overflow: hidden;
    background: #f6f6f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* Settings view – menu sections */
.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

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

.profile-menu-section-title {
    font-size: 12px;
    font-weight: 500;
    color: #111;
    margin: 0;
}

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

.profile-menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

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

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

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

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

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

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

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

.profile-menu-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

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

/* 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: 2px;
    top: 2px;
    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);
}

/* Sub-views (Account, Personen, etc.) – header with back; base layout in .modal-header-bar above */
.profile-subview-header .profile-subview-title {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.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;
}

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

.profile-back-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

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

.profile-subview-title {
    font-size: 18px;
    font-weight: 700;
    color: #111;
    margin: 0;
    transition: opacity 0.2s ease;
}

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

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

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

/* Right slot same width as back for centering */
.profile-subview-header .profile-header-right {
    width: var(--icon-btn-size);
    min-width: var(--icon-btn-size);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-close-btn--inline {
    position: static;
    top: auto;
    right: auto;
    width: var(--icon-btn-size);
    height: var(--icon-btn-size);
}

/* + button for adding category (same circle as close) */
.profile-header-action-add {
    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;
    font-size: 1.5rem;
    line-height: 1;
    color: #111;
    transition: background 0.2s;
}

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

/* Kategorien view – large title (can combine with .modal-large-title) */
.categories-title {
    font-size: 28px;
    font-weight: 700;
    color: #111;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.categories-section {
    margin-bottom: 16px;
}

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

.categories-section-title {
    font-size: 12px;
    font-weight: 500;
    color: #111;
    margin: 0 0 8px 0;
}

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

.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-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 svg {
    width: 18px;
    height: 18px;
    color: #111;
}

/* Input system (Figma 301:2228) – Default, Focus, Error */
.input-figma {
    width: 100%;
    min-height: 64px;
    padding: 12px 16px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    color: #111;
    transition: border-color 0.2s;
}

.input-figma::placeholder {
    color: #d6d6d6;
    font-size: 12px;
}

.input-figma:focus {
    outline: none;
    border-color: #2f51eb;
}

.input-figma.is-error {
    border-color: #c53030;
}

/* 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 {
    width: 24px;
    height: 24px;
}

/* 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 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    margin-bottom: 12px;
}

.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-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.setting-input {
    width: 100%;
    min-height: 64px;
    padding: 12px 16px;
    border: 2px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    color: #111;
    background: #fff;
    transition: border-color 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: #2f51eb;
}

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

.profile-message.success {
    color: #0a7c42;
}

.profile-message.error {
    color: #c53030;
}

.modal-button-secondary {
    background: #1d1d1f;
    margin-top: 8px;
}

.modal-button-secondary:hover {
    background: #424245;
}

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

.logout-profile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    font-weight: 500;
    color: #c53030;
    background: transparent;
    border: 1px solid #c53030;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.logout-profile-button:hover {
    background-color: #c53030;
    color: white;
}

.logout-profile-button:hover .logout-profile-icon {
    filter: invert(1);
}

.logout-profile-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

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

.spaces-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 8px;
}

.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: 4px;
}

.spaces-layout-setting-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0 12px;
}

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

.layout-segment-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #797979;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.layout-segment-btn.is-active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

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

/* ISO 7810 ID-1 ratio (width:height ≈ 1.586:1) — landscape payment card */
.wallet-card {
    position: relative;
    width: 100%;
    aspect-ratio: 1.586 / 1;
    border-radius: 16px;
    background: var(--wallet-card-bg, #333);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    outline: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    margin-top: -26%;
    z-index: 0;
}

.wallet-card:first-child {
    margin-top: 0;
}

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

.spaces-stack--grid .wallet-card-inner {
    padding: 12px;
}

.spaces-stack--grid .wallet-card-body {
    gap: 8px;
}

.spaces-stack--grid .wallet-card-title {
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spaces-stack--grid .wallet-card-pills {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.spaces-stack--grid .wallet-card-pill {
    font-size: 10px;
    height: 22px;
    line-height: 20px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spaces-stack--grid .wallet-card-member-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.spaces-stack--grid .wallet-card-member-avatar + .wallet-card-member-avatar {
    margin-left: -8px;
}

.wallet-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.12);
}

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

.wallet-card-inner {
    height: 100%;
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    min-height: 0;
    box-sizing: border-box;
}

.wallet-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.wallet-card-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    word-break: break-word;
    text-align: left;
}

.wallet-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.wallet-card-pill {
    font-size: 11px;
    font-weight: 500;
    padding: 0 10px;
    height: 26px;
    line-height: 24px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wallet-card-members {
    margin-top: auto;
    flex-shrink: 0;
}

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

.wallet-card-member-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

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

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

.wallet-card-member-avatar--placeholder {
    font-size: 14px;
    line-height: 1;
}

/* 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-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 {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    accent-color: #2f51eb;
    cursor: pointer;
}

.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: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

#app-shell > .app-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    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-pill {
    color: transparent;
    min-width: 100px;
    min-height: 14px;
    border-radius: 6px;
}

.wallet-card--loading .wallet-card-pill .skeleton-shimmer {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 14px;
}

.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%;
    flex-direction: column;
    background: #fff;
    animation: none;
}

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

/* 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;
    }

    .wallet-card {
        transition: none;
    }
}

/* Community + shared spaces */
.wallet-card-shared-badge,
.shared-inline-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.45);
    vertical-align: middle;
}

.shared-inline-badge {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: inherit;
    text-transform: none;
    font-size: 11px;
    font-weight: 500;
}

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

.community-search-controls .setting-input {
    flex: 1;
    min-width: 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 {
    padding: 8px 12px;
    font-size: 13px;
    width: auto;
    min-width: 0;
    flex-shrink: 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 .modal-button {
    margin-top: 16px;
    width: 100%;
}

