:root {
    --app-bg: #f2f4f7;
    --app-card: #ffffff;
    --app-ink: #111827;
    --app-muted: #6b7280;
    --app-line: #e5e7eb;
    --app-radius: 1.15rem;
    --nav-h: 4.15rem;
    --top-h: 3.55rem;
}

.app-body {
    margin: 0;
    min-height: 100dvh;
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: var(--font, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
    font-size: var(--font-size, 16px);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.app-body a { color: var(--primary); text-decoration: none; }
.app-body .lang-switcher__list a,
.app-body .lang-switcher__list a:link,
.app-body .lang-switcher__list a:visited,
.app-body .lang-switcher__list a:hover {
    color: #0b162b;
}
.app-body a.btn,
.app-body a.btn:link,
.app-body a.btn:visited,
.app-body a.btn:hover,
.app-body a.btn:active { color: #fff; }
.app-body a.btn--ghost,
.app-body a.btn--ghost:link,
.app-body a.btn--ghost:visited,
.app-body a.btn--ghost:hover,
.app-body a.btn--ghost:active { color: var(--primary); background: transparent; }

.app-rail { display: none; }

.app-frame {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}
body.has-bottom-nav .app-frame {
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
body.has-mobile-lang:not(.has-bottom-nav) .app-frame {
    padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 1rem 0;
    background: color-mix(in srgb, var(--app-bg) 86%, white);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
}

.app-topbar__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    min-width: 0;
    justify-self: stretch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-topbar__back,
.app-topbar__bell,
.app-topbar__avatar,
.app-topbar__menu--bar {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: var(--app-card);
    color: var(--app-ink);
    position: relative;
    overflow: visible;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
    cursor: pointer;
    touch-action: manipulation;
}

.app-topbar__back svg,
.app-topbar__bell svg,
.app-topbar__menu--bar svg { width: 1.25rem; height: 1.25rem; }
.app-topbar__avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-topbar__avatar span { font-size: 0.72rem; font-weight: 700; color: var(--primary); }

.app-tabs {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.35rem 1rem 0.55rem;
    scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar { display: none; }
.app-tabs__link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.75rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: #fff;
    color: var(--app-ink);
    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.05);
    touch-action: manipulation;
}
.app-tabs__link.is-active {
    background: var(--primary);
    color: #fff;
}

.app-content {
    flex: 1;
    width: min(42rem, 100%);
    margin: 0 auto;
    padding: 0.75rem 1rem 1.5rem;
}

.app-page { display: grid; gap: 1rem; }
.app-hero h2 { margin: 0.1rem 0 0.35rem; font-size: 1.7rem; letter-spacing: -0.03em; }
.app-kicker { margin: 0; font-size: 0.8rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: 0.06em; }

.app-card {
    background: var(--app-card);
    border-radius: var(--app-radius);
    padding: 1rem 1.05rem;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.04);
}

.app-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}
.app-card h3 { margin: 0 0 0.65rem; font-size: 1rem; }

.app-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}
.app-gallery-manage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin: 0.75rem 0 1.1rem;
}
.app-gallery-manage figure { margin: 0; }
.app-gallery-manage img,
.app-gallery-manage video {
    width: 100%;
    height: 5.6rem;
    object-fit: cover;
    border-radius: 0.8rem;
    display: block;
    background: #111;
}
.app-faq-item {
    border-top: 1px solid var(--app-line);
    padding: 0.85rem 0 1rem;
}
.app-faq-item:first-of-type { border-top: 0; }
.app-stat {
    background: var(--app-card);
    border-radius: var(--app-radius);
    padding: 0.9rem;
    color: inherit;
    text-decoration: none;
    min-height: 5.4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    touch-action: manipulation;
}
.app-body a.app-stat { color: inherit; }
.app-stat__label { margin: 0; color: var(--app-muted); font-size: 0.78rem; }
.app-stat__value { margin: 0.2rem 0 0; font-size: 1.2rem; font-weight: 750; letter-spacing: -0.03em; }

.app-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.55rem;
}
.app-action {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    background: var(--app-card);
    color: inherit;
    border-radius: 1rem;
    padding: 0.85rem 0.65rem;
    min-height: 4.75rem;
    touch-action: manipulation;
}
.app-body a.app-action { color: inherit; }
.app-action span { font-weight: 700; font-size: 0.9rem; }
.app-action small { color: var(--app-muted); font-size: 0.72rem; }

.app-list { list-style: none; margin: 0; padding: 0; }
.app-list li { border-top: 1px solid var(--app-line); padding: 0.65rem 0; display: grid; gap: 0.2rem; }
.app-list li:first-child { border-top: 0; }
.app-list .muted { font-size: 0.85rem; }
.app-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    color: inherit;
    min-height: 3.1rem;
}
.app-row strong, .app-row em { display: block; }
.app-row span, .app-row small { display: block; color: var(--app-muted); font-size: 0.82rem; font-weight: 400; }
.app-row em { font-style: normal; font-weight: 700; white-space: nowrap; }

.app-stack { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

.app-gift, .app-history, .app-receipt-row, .app-note {
    background: var(--app-card);
    border-radius: var(--app-radius);
    padding: 1rem;
    box-shadow: 0 8px 24px rgb(15 23 42 / 0.04);
}
.app-gift__campaign { margin: 0; font-weight: 650; }
.app-gift__amount { margin: 0.25rem 0; font-size: 1.35rem; font-weight: 750; letter-spacing: -0.03em; }
.app-gift__amount span { font-size: 0.85rem; color: var(--app-muted); font-weight: 600; }
.app-gift__meta, .app-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.7rem;
}

.app-history__top {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.app-history__top a { font-weight: 700; color: inherit; }

.app-dl {
    display: grid;
    gap: 0.55rem;
    margin: 0;
}
.app-dl div { display: flex; justify-content: space-between; gap: 1rem; }
.app-dl dt { margin: 0; color: var(--app-muted); font-size: 0.82rem; }
.app-dl dd { margin: 0; font-weight: 600; text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; word-break: break-all; }

.app-amount { margin: 0.2rem 0; font-size: 1.8rem; letter-spacing: -0.04em; }
.app-amount span { font-size: 0.95rem; color: var(--app-muted); }

.app-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.5rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #eef1f4;
    color: #374151;
    font-style: normal;
}
.app-pill--successful, .app-pill--open, .app-pill--active { background: #dcfce7; color: #166534; }
.app-pill--pending, .app-pill--processing, .app-pill--incomplete, .app-pill--in_progress { background: #fef3c7; color: #92400e; }
.app-pill--failed, .app-pill--cancelled, .app-pill--closed, .app-pill--refunded { background: #fee2e2; color: #991b1b; }
.app-pill--partially_refunded, .app-pill--resolved { background: #e0e7ff; color: #3730a3; }
.app-pill--high { background: #fee2e2; color: #991b1b; }

.app-empty, .app-empty-card { color: var(--app-muted); text-align: center; padding: 1.5rem 1rem; }
.app-empty-card {
    background: var(--app-card);
    border-radius: var(--app-radius);
    display: grid;
    gap: 0.85rem;
    justify-items: center;
}

.app-form label { display: block; margin: 0.75rem 0; font-weight: 600; font-size: 0.9rem; }
.app-form input, .app-form select, .app-form textarea {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    min-height: 2.85rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--app-line);
    border-radius: 0.85rem;
    font: inherit;
    background: #fafafa;
}
.app-form input:focus, .app-form select:focus, .app-form textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--primary) 35%, white);
    border-color: var(--primary);
    background: #fff;
}
.app-form input[readonly] { color: var(--app-muted); }
.hint { display: block; margin-top: 0.25rem; font-size: 0.8rem; font-weight: 500; color: var(--app-muted); }

.app-profile-photo { display: grid; justify-items: center; text-align: center; gap: 0.55rem; }
.app-avatar {
    width: 3.2rem; height: 3.2rem; border-radius: 999px; overflow: hidden;
    display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 15%, white);
    color: var(--primary); font-weight: 800;
}
.app-avatar--lg { width: 5.5rem; height: 5.5rem; font-size: 1.4rem; }
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-photo-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: var(--primary);
    color: #fff !important;
    font-weight: 650;
    cursor: pointer;
}
.app-photo-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.app-flash { padding: 0.75rem 0.9rem; border-radius: 0.9rem; margin: 0 0 0.75rem; }
.app-flash--error { background: #fee2e2; color: #991b1b; }
.app-flash--ok { background: #dcfce7; color: #166534; }

.app-badge {
    display: inline-grid;
    place-items: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: var(--secondary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
}
.app-badge--dot { position: absolute; top: 0.15rem; right: 0.15rem; }

.app-note { display: grid; gap: 0.55rem; color: inherit; }
.app-note.is-unread { box-shadow: inset 3px 0 0 var(--primary); }
.app-note__body { display: grid; gap: 0.25rem; color: inherit; text-decoration: none; }
.app-note small { color: var(--app-muted); }
.app-note__actions, .app-note-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}
.app-note-toolbar { justify-content: flex-end; margin-bottom: 0.75rem; }
.app-note__actions form { margin: 0; }

.app-session { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0; align-items: center; }
.app-session.is-revoked { opacity: 0.55; }
.app-session em { font-style: normal; font-size: 0.78rem; color: var(--primary); font-weight: 700; }

.app-thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.65rem; }
.app-bubble {
    padding: 0.8rem 0.95rem;
    border-radius: 1rem;
    background: var(--app-card);
}
.app-bubble p { margin: 0 0 0.35rem; }
.app-bubble small { color: var(--app-muted); }
.app-bubble--you { border-bottom-right-radius: 0.3rem; }
.app-bubble--staff { background: color-mix(in srgb, var(--primary) 10%, white); border-bottom-left-radius: 0.3rem; }
.app-files { list-style: none; margin: 0 0 0.4rem; padding: 0; display: grid; gap: 0.25rem; }
.app-files a { font-weight: 650; }

.btn--block { width: 100%; justify-content: center; }
.btn--sm { min-height: 2.2rem; padding: 0.3rem 0.75rem; font-size: 0.85rem; }
.app-inline-form { display: flex; justify-content: flex-end; }

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding: 0.28rem 0.4rem calc(0.28rem + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid #eceff3;
    box-shadow: 0 -8px 24px rgba(11, 22, 43, 0.06);
}
.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    color: #8b93a0;
    min-width: 0;
    min-height: 2.85rem;
    padding: 0.15rem 0.1rem;
    text-decoration: none;
    touch-action: manipulation;
    transition: color 0.15s ease;
}
.bottom-nav__item.is-active { color: var(--accent, var(--primary)); }
.bottom-nav__icon {
    width: 1.5rem;
    height: 1.5rem;
    display: grid;
    place-items: center;
}
.bottom-nav__icon svg { width: 1.32rem; height: 1.32rem; fill: currentColor; }
.bottom-nav__label {
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 374px) {
    .bottom-nav {
        padding-inline: 0.12rem;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
    .bottom-nav__label {
        font-size: 0.6rem;
        letter-spacing: -0.01em;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .bottom-nav__item--donate .bottom-nav__icon {
        width: 2.7rem;
        height: 2.7rem;
        margin-top: -1.05rem;
    }
}
.bottom-nav__item--donate .bottom-nav__icon {
    width: 3rem;
    height: 3rem;
    margin-top: -1.35rem;
    border-radius: 999px;
    background: var(--accent, var(--primary));
    color: #fff;
    box-shadow: 0 10px 18px color-mix(in srgb, var(--accent, var(--primary)) 38%, transparent);
}
.bottom-nav__item--donate .bottom-nav__icon svg { width: 1.25rem; height: 1.25rem; }
.bottom-nav__item--donate.is-active { color: var(--accent, var(--primary)); }
.bottom-nav__item--donate .bottom-nav__label { color: var(--ink, #0b162b); }
.bottom-nav__item--donate.is-active .bottom-nav__label { color: var(--accent, var(--primary)); }

body:not(.has-bottom-nav) {
    --nav-h: 0px;
}
body:not(.has-bottom-nav) .bottom-nav {
    display: none !important;
}

body:not(.app-body) {
    padding-bottom: 0;
}
body:not(.app-body) .site-footer {
    margin-bottom: 0;
    padding-bottom: 1.5rem;
}
@media (max-width: 1099px) {
    body.has-mobile-lang:not(.has-bottom-nav):not(.app-body) .site-footer {
        padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    }
    body.has-bottom-nav:not(.has-mobile-lang):not(.app-body) .site-footer {
        padding-bottom: calc(1.25rem + 4.15rem + env(safe-area-inset-bottom, 0px));
    }
    body.has-bottom-nav.has-mobile-lang:not(.app-body) .site-footer {
        padding-bottom: calc(4.75rem + 4.15rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 1099px) {
    .nav--desktop { display: none; }
}

@media (min-width: 1100px) {
    .bottom-nav { display: none; }
    body:not(.app-body) { padding-bottom: 0; }
    body:not(.app-body) .site-footer { padding-bottom: 1.5rem; }

    .app-body {
        display: grid;
        grid-template-columns: 16.5rem 1fr;
    }
    .app-rail {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 1.25rem 1rem;
        background: #fff;
        border-right: 1px solid var(--app-line);
        position: sticky;
        top: 0;
        height: 100dvh;
    }
    .app-rail__brand {
        font-weight: 800;
        color: var(--primary);
        font-size: 1.05rem;
        padding: 0.35rem 0.65rem;
        display: flex;
        align-items: center;
    }
    .app-rail__brand .brand-mark img { max-height: 2rem; }
    .app-rail__nav { display: grid; gap: 0.2rem; }
    .app-rail__link {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.7rem 0.75rem;
        border-radius: 0.85rem;
        color: var(--app-ink);
        font-weight: 600;
    }
    .app-rail__link.is-active { background: color-mix(in srgb, var(--primary) 12%, white); color: var(--primary); }
    .app-rail__admin { margin-top: auto; padding: 0.7rem 0.75rem; color: var(--app-muted); }
    .app-frame { padding-bottom: 0; }
    .app-tabs { display: none; }
    .app-topbar { grid-template-columns: minmax(0, 1fr) auto; }
    .app-topbar:has(.app-topbar__back) { grid-template-columns: auto minmax(0, 1fr) auto; }
    .app-topbar__title { text-align: start; }
    .app-topbar__menu--bar { display: none; }
    #account-drawer,
    #account-drawer-backdrop { display: none !important; }
    .app-content { width: min(52rem, calc(100% - 2rem)); padding-top: 1.25rem; }
}

@media print {
    .app-topbar, .app-rail, .app-tabs, .bottom-nav, .no-print, .site-header, .site-footer,
    .nav-drawer, .nav-drawer__backdrop, .pwa-install { display: none !important; }
    .app-frame, .app-body, body { padding: 0; background: #fff; }
}
