:root {
    --bg: #f5f0e7;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #fffdf8;
    --text: #18222a;
    --muted: #5f6e72;
    --line: rgba(24, 34, 42, 0.08);
    --brand: #1b6b70;
    --brand-soft: #d8efed;
    --accent: #f08a5d;
    --danger: #ba4a3f;
    --success: #2f8d5d;
    --shadow: 0 20px 48px rgba(27, 35, 42, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
    --bg: #121714;
    --surface: rgba(27, 33, 29, 0.9);
    --surface-strong: #202820;
    --text: #f2f2e8;
    --muted: #aab7ad;
    --line: rgba(242, 242, 232, 0.12);
    --brand: #7dd7ce;
    --brand-soft: rgba(125, 215, 206, 0.14);
    --accent: #f2a06f;
    --danger: #f08b7f;
    --success: #75d69b;
    --shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Aptos", "Segoe UI Variable Display", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(240, 138, 93, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(27, 107, 112, 0.15), transparent 32%),
        linear-gradient(180deg, #fcf7ef 0%, #f5f0e7 100%);
    color: var(--text);
}

html[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(240, 138, 93, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(125, 215, 206, 0.16), transparent 34%),
        linear-gradient(180deg, #0f1412 0%, #171d19 100%);
}

body {
    overscroll-behavior-y: none;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: wait;
    opacity: 0.68;
}

#app {
    min-height: 100vh;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 999;
    padding: 1rem 1.25rem calc(1rem + var(--safe-bottom));
    background: #fef6ea;
    border-top: 1px solid rgba(24, 34, 42, 0.1);
}

#blazor-error-ui .dismiss {
    margin-left: 1rem;
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    padding: 1rem 1rem calc(6.5rem + var(--safe-bottom));
}

.app-header {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.app-header__top {
    display: grid;
    grid-template-columns: minmax(5.5rem, 1fr) auto minmax(5.5rem, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.header-side {
    min-height: 2.75rem;
    display: flex;
    align-items: center;
}

.header-side--right {
    justify-content: flex-end;
}

.header-wordmark {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding-left: 0.35rem;
    color: var(--brand);
    font-weight: 800;
    font-size: 1.08rem;
    letter-spacing: 0.12em;
}

.app-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
}

.app-logo img {
    display: block;
    width: min(9rem, 44vw);
    height: auto;
    object-fit: contain;
}

.app-header__statusline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.2rem;
    padding: 0 0.1rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.app-header__status-text {
    min-width: 0;
}

.hero-card h1,
.event-card__title,
.detail-header h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    letter-spacing: -0.04em;
}

.eyebrow {
    margin: 0 0 0.25rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.sync-pill,
.chip,
.stat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(24, 34, 42, 0.06);
    font-size: 0.9rem;
}

.sync-pill {
    cursor: pointer;
}

.header-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(24, 34, 42, 0.07);
    font-size: 0.92rem;
}

.header-back__icon {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background: rgba(27, 107, 112, 0.12);
    color: var(--brand);
    font-weight: 700;
}

.header-install {
    display: inline-flex;
    grid-column: 2;
    align-items: center;
    justify-content: center;
    justify-self: end;
    min-height: 2.15rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(27, 107, 112, 0.18);
    background: rgba(27, 107, 112, 0.1);
    color: var(--brand);
    box-shadow: 0 10px 24px rgba(24, 34, 42, 0.07);
    white-space: nowrap;
    font-size: 0.88rem;
}

.sync-pill.is-online,
.sync-banner.is-online {
    color: var(--success);
}

.sync-pill.is-offline,
.sync-banner.is-offline {
    color: var(--danger);
}

.sync-banner {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    font-size: 0.92rem;
}

.cookie-panel {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #fffdf8;
    border: 1px solid rgba(27, 107, 112, 0.16);
    box-shadow: 0 16px 34px rgba(24, 34, 42, 0.12);
}

.cookie-panel p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.app-content,
.page-shell {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.hero-card,
.card,
.form-card,
.summary-card,
.list-card {
    padding: 1.1rem;
    border-radius: var(--radius-lg);
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.48);
    box-shadow: var(--shadow);
}

html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .list-card,
html[data-theme="dark"] .event-card,
html[data-theme="dark"] .movement-card,
html[data-theme="dark"] .member-card,
html[data-theme="dark"] .suggestion-card,
html[data-theme="dark"] .selection-row,
html[data-theme="dark"] .cookie-panel,
html[data-theme="dark"] .action-menu {
    background: linear-gradient(180deg, rgba(33, 41, 34, 0.94) 0%, rgba(25, 32, 27, 0.94) 100%);
    border-color: rgba(242, 242, 232, 0.1);
}

.hero-card p,
.card-subtitle,
.muted,
.empty-state p {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.button-row,
.inline-actions,
.quick-actions,
.tabs,
.grid-two,
.stack {
    display: grid;
    gap: 0.75rem;
}

.button-row,
.quick-actions,
.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.cancel-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.2rem;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    border: 0;
    cursor: pointer;
}

.primary-btn {
    background: linear-gradient(135deg, var(--brand), #285b9f);
    color: #fff;
    box-shadow: 0 14px 28px rgba(27, 107, 112, 0.24);
}

.primary-btn:disabled {
    box-shadow: none;
}

.secondary-btn {
    background: var(--brand-soft);
    color: var(--brand);
}

.ghost-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

.cancel-btn {
    background: rgba(95, 110, 114, 0.1);
    color: var(--muted);
    border: 1px solid rgba(95, 110, 114, 0.18);
}

.danger-btn {
    background: rgba(186, 74, 63, 0.12);
    color: var(--danger);
}

.quick-actions .primary-btn,
.quick-actions .secondary-btn,
.quick-actions .ghost-btn,
.quick-actions .cancel-btn,
.quick-actions .danger-btn {
    justify-content: flex-start;
    text-align: left;
}

.field,
.field-inline,
.selection-list,
.event-list,
.movement-list,
.member-list,
.suggestions-list {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.field label {
    font-size: 0.95rem;
    color: #3d5056;
    font-weight: 700;
}

.field p {
    margin: 0;
    overflow-wrap: anywhere;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 3.1rem;
    padding: 0.8rem 0.95rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .header-back,
html[data-theme="dark"] .sync-pill,
html[data-theme="dark"] .chip,
html[data-theme="dark"] .stat-pill,
html[data-theme="dark"] .tab-link,
html[data-theme="dark"] .icon-btn {
    background: rgba(32, 40, 32, 0.92);
}

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

.expense-editor-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.validation-message {
    color: var(--danger);
    font-size: 0.84rem;
}

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

.consent-row a {
    color: var(--brand);
    font-weight: 700;
}

.empty-state {
    padding: 1.2rem;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(24, 34, 42, 0.16);
    background: rgba(255, 255, 255, 0.42);
    text-align: center;
}

.event-card,
.movement-card,
.member-card,
.suggestion-card,
.selection-row {
    display: grid;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #fffdf8 0%, #fff8ee 100%);
    border: 1px solid rgba(125, 103, 76, 0.18);
    box-shadow: 0 12px 30px rgba(75, 62, 42, 0.08);
    min-width: 0;
}

.event-card,
.movement-card {
    border-color: rgba(27, 107, 112, 0.2);
}

.event-list,
.movement-list {
    gap: 1rem;
}

.movement-card {
    position: relative;
}

.event-card__meta,
.movement-card__meta,
.detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.event-card__amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.detail-header,
.detail-section-head {
    display: grid;
    gap: 0.75rem;
}

.detail-section-head {
    grid-template-columns: 1fr auto;
    align-items: center;
}

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

.summary-box {
    padding: 0.95rem;
    border-radius: 18px;
    background: rgba(27, 107, 112, 0.08);
    border: 1px solid rgba(27, 107, 112, 0.12);
    min-width: 0;
}

.summary-box strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.2rem;
    overflow-wrap: anywhere;
}

.summary-box .eyebrow {
    white-space: nowrap;
}

.tabs {
    grid-auto-flow: column;
    grid-auto-columns: minmax(8rem, 1fr);
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.tab-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 2.8rem;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.tab-link.active {
    background: var(--brand);
    color: #fff;
    border-color: transparent;
}

.bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.65rem 0.6rem calc(0.65rem + var(--safe-bottom));
    background: rgba(255, 253, 248, 0.92);
    backdrop-filter: blur(18px);
    border-top: 1px solid rgba(24, 34, 42, 0.08);
}

.bottom-nav__link {
    display: grid;
    justify-items: center;
    gap: 0.22rem;
    padding: 0.55rem 0.25rem;
    border-radius: 16px;
    color: var(--muted);
    font-size: 0.76rem;
}

.bottom-nav__link.active {
    background: rgba(27, 107, 112, 0.12);
    color: var(--brand);
    font-weight: 700;
}

.bottom-nav__icon {
    font-size: 1rem;
}

.fab {
    position: fixed;
    right: 1rem;
    bottom: calc(5.8rem + var(--safe-bottom));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.6rem;
    min-height: 3.6rem;
    padding: 0 1.1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #ef6b64);
    color: #fff;
    box-shadow: 0 18px 34px rgba(240, 138, 93, 0.28);
}

.splash-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.splash-card {
    width: min(100%, 24rem);
    padding: 1.8rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.56);
    box-shadow: var(--shadow);
    text-align: center;
}

.splash-logo {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 0.8rem;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--brand), #285b9f);
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
}

.splash-logo--image {
    width: min(8rem, 42vw);
    height: auto;
    padding: 0.35rem;
    background: #fff;
    box-shadow: none;
}

.splash-logo--image img {
    display: block;
    width: 100%;
    height: auto;
}

.login-progress {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-sm);
    background: rgba(27, 107, 112, 0.09);
    border: 1px solid rgba(27, 107, 112, 0.14);
    color: var(--brand);
    font-weight: 700;
}

.tiny-spinner {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    border: 2px solid rgba(27, 107, 112, 0.2);
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}

.theme-toggle {
    justify-content: space-between;
}

.theme-toggle__icon {
    font-size: 1.25rem;
}

.movement-card__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.movement-card__date {
    justify-self: center;
    text-align: center;
}

.movement-card__actions {
    position: relative;
    justify-self: end;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 999px;
    border: 1px solid rgba(24, 34, 42, 0.1);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 10px 22px rgba(24, 34, 42, 0.08);
}

.action-menu {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 20;
    display: grid;
    gap: 0.25rem;
    min-width: 9rem;
    padding: 0.45rem;
    border-radius: 16px;
    background: #fffdf8;
    border: 1px solid rgba(24, 34, 42, 0.12);
    box-shadow: 0 18px 38px rgba(24, 34, 42, 0.16);
}

.action-menu button {
    min-height: 2.55rem;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    text-align: left;
}

.action-menu button:hover,
.action-menu button:focus-visible {
    background: rgba(27, 107, 112, 0.08);
}

.action-menu .danger-action {
    color: var(--danger);
}

.movement-card__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.movement-card__contributions {
    display: grid;
    gap: 0.55rem;
    min-width: 0;
}

.movement-card__contribution {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    background: rgba(27, 107, 112, 0.06);
    border: 1px solid rgba(27, 107, 112, 0.1);
}

.movement-card__contribution span,
.movement-card__contribution strong {
    overflow-wrap: anywhere;
}

.invitation-card,
.invitation-card__content {
    min-width: 0;
}

.invitation-card__meta {
    align-items: center;
}

.invitation-card .field label {
    color: var(--brand);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.invitation-link {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.accepted-list {
    display: grid;
    gap: 0.25rem;
}

.invitation-share-panel {
    display: grid;
    gap: 0.8rem;
    padding: 0.95rem;
    border: 1px solid rgba(27, 107, 112, 0.16);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(27, 107, 112, 0.08), rgba(236, 233, 219, 0.32));
    min-width: 0;
}

.invitation-share-panel > strong {
    font-size: 1.02rem;
}

html[data-theme="dark"] .invitation-share-panel {
    background: linear-gradient(180deg, rgba(27, 107, 112, 0.18), rgba(25, 32, 27, 0.9));
    border-color: rgba(242, 242, 232, 0.12);
}

.legal-copy {
    line-height: 1.55;
}

.legal-copy h2 {
    margin: 1rem 0 0.35rem;
}

.legal-copy h2:first-child {
    margin-top: 0;
}

.legal-copy p {
    margin: 0.25rem 0;
    color: var(--muted);
}

.contact-lines {
    display: grid;
    gap: 0.2rem;
}

.contact-lines p {
    margin: 0;
    text-align: center;
}

.member-card .button-row {
    grid-template-columns: 1fr;
}

.member-card .secondary-btn,
.member-card .ghost-btn {
    justify-content: flex-start;
    text-align: left;
}

.skeleton-bar {
    width: 100%;
    height: 0.5rem;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(27, 107, 112, 0.14), rgba(240, 138, 93, 0.28), rgba(27, 107, 112, 0.14));
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

@media (min-width: 768px) {
    .app-shell {
        width: min(100%, 62rem);
        margin: 0 auto;
        padding-inline: 1.25rem;
    }

    .button-row,
    .quick-actions,
    .summary-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        width: min(100%, 62rem);
        border-radius: 22px 22px 0 0;
    }
}
