@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,600;9..144,700&display=swap');

:root {
    --ink: #14261e;
    --muted: #718077;
    --cream: #fffdf8;
    --paper: #fff;
    --orange: #f5a524;
    --coral: #ef6e59;
    --mint: #cbeccf;
    --line: #e9ece5;
    --shadow: 0 18px 45px rgba(31, 58, 43, .13);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background: #eaf0e8;
    font-family: 'DM Sans', sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
    border: 0;
}

.app-shell {
    max-width: 560px;
    min-height: 100dvh;
    margin: auto;
    padding-bottom: 102px;
    background: var(--cream);
    overflow: hidden;
}

.hero {
    position: relative;
    min-height: 355px;
    padding: 24px 24px 28px;
    overflow: hidden;
    color: #163227;
    background: linear-gradient(137deg, #c2ebc3 0%, #d7f3bd 52%, #f7d58d 100%);
}

.hero::after {
    content: '';
    position: absolute;
    width: 360px;
    height: 150px;
    right: -105px;
    bottom: -63px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .38);
    transform: rotate(-12deg);
}

.sun-glow {
    position: absolute;
    top: -62px;
    right: -50px;
    width: 216px;
    height: 216px;
    border-radius: 50%;
    background: rgba(255, 223, 111, .66);
    animation: sunPulse 4s ease-in-out infinite;
}

.sparkle {
    position: absolute;
    color: #fff8d1;
    font-size: 29px;
    animation: floatSparkle 3s ease-in-out infinite;
}

.s1 {
    right: 134px;
    top: 90px;
    animation-delay: 0s;
}

.s2 {
    right: 35px;
    top: 196px;
    font-size: 18px;
    animation-delay: 1.5s;
}

.hero-top,
.section-heading,
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.trip-switcher {
    text-align: left;
    padding: 0;
    color: var(--ink);
    background: none;
}

.tiny-label,
.eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
}

.trip-name {
    display: block;
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
}

.trip-name b {
    margin-left: 4px;
    font-size: 16px;
}

.avatar-stack {
    display: flex;
    padding: 0;
    background: none
}

.avatar {
    display: grid;
    place-items: center;
    width: 29px;
    height: 29px;
    margin-left: -7px;
    border: 2px solid #d4edc5;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700
}

.a1 {
    background: #f7b5a8
}

.a2 {
    background: #b8c2ef
}

.a3 {
    background: #f5d385
}

.more {
    background: #204f3c;
    color: #fff
}

.hero h1 {
    position: relative;
    z-index: 1;
    margin: 25px 0 5px;
    font-family: Fraunces, serif;
    font-size: 59px;
    line-height: 1;
    letter-spacing: -2.8px;
}

.eyebrow {
    position: relative;
    z-index: 1;
    margin-top: 50px;
    color: #47705a;
}

.trip-meta {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 9px;
    align-items: center;
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #4c725c
}

.trip-meta i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #75a87d
}

.budget-card {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px 14px;
    margin-top: 27px;
    padding: 14px 15px;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 16px;
    backdrop-filter: blur(8px)
}

.budget-card span,
.budget-card b {
    font-size: 11px;
    color: #51705b
}

.budget-card strong {
    display: block;
    margin-top: 2px;
    font-size: 14px
}

.total-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.total-card b {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    color: #47705a;
    text-align: right;
}

.progress {
    align-self: center;
    width: 72px;
    height: 6px;
    border-radius: 10px;
    background: rgba(28, 71, 48, .14);
    overflow: hidden
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #e97952
}

.budget-card b {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-weight: 700
}

.content {
    padding: 27px 20px 0;
}

.section-heading h2,
.sheet-header h2 {
    margin: 4px 0 0;
    font-family: Fraunces, serif;
    font-size: 25px;
    letter-spacing: -.8px
}

.icon-button {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    color: #355346;
    font-size: 22px
}

.filter-row {
    display: flex;
    gap: 8px;
    overflow: auto;
    padding: 16px 0 5px
}

.chip {
    padding: 8px 14px;
    border-radius: 20px;
    background: #f0f2ed;
    color: #66766c;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .25s ease, color .25s ease, transform .15s ease;
}

.chip:active {
    transform: scale(.95);
}

.chip.active {
    background: #214d3d;
    color: #fff;
}

.expense-list {
    margin-top: 14px
}

.date-label {
    margin: 21px 0 9px;
    color: #879188;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .9px
}

.expense-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #f0f0eb;
    border-radius: 18px;
    box-shadow: 0 4px 13px rgba(31, 58, 43, .035);
    transition: transform .2s ease, box-shadow .2s ease;
}

.expense-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(31, 58, 43, .08);
}

.expense-card.card-animate {
    animation: slideUp .4s cubic-bezier(.22, .9, .3, 1) both;
    animation-delay: var(--delay, 0ms);
}

.expense-icon {
    display: grid;
    place-items: center;
    width: 47px;
    height: 47px;
    border-radius: 15px;
    font-size: 22px
}

.expense-card:nth-of-type(3n) .expense-icon {
    background: #fff0d4
}

.expense-card:nth-of-type(3n+1) .expense-icon {
    background: #e2f3e4
}

.expense-card:nth-of-type(3n+2) .expense-icon {
    background: #fde4dd
}

.expense-info {
    flex: 1;
    min-width: 0
}

.expense-info h3 {
    overflow: hidden;
    margin: 0 0 3px;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis
}

.expense-info p {
    margin: 0;
    color: #89948c;
    font-size: 11px
}

.expense-value {
    text-align: right
}

.expense-value b {
    display: block;
    font-size: 14px
}

.expense-value span {
    color: #6e8876;
    font-size: 11px
}

.receipt-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-left: 4px;
    border-radius: 50%;
    background: var(--coral)
}

.bottom-nav {
    position: fixed;
    z-index: 10;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: min(6vw, 34px);
    height: 82px;
    padding: 7px max(22px, calc((100vw - 560px)/2 + 22px));
    background: rgba(255, 253, 248, .94);
    border-top: 1px solid #eee;
    backdrop-filter: blur(12px)
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 43px;
    padding: 0;
    background: none;
    color: #a0aaa1;
    font-size: 10px;
    font-weight: 700;
    transition: color .2s ease, transform .15s ease;
}

.nav-item span {
    font-size: 20px;
    line-height: 20px;
    transition: transform .2s ease;
}

.nav-item.active {
    color: #285a47;
}

.nav-item.active span {
    transform: scale(1.15);
}

.nav-item:active {
    transform: scale(.92);
}

.add-button {
    display: grid;
    place-items: center;
    width: 53px;
    height: 53px;
    margin: 0 7px;
    border-radius: 18px;
    background: var(--orange);
    box-shadow: 0 8px 20px rgba(245, 165, 36, .32);
    color: #1f392d;
    font-size: 30px;
    font-weight: 400;
    transition: transform .2s cubic-bezier(.22, .9, .3, 1), box-shadow .2s ease;
}

.add-button:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 28px rgba(245, 165, 36, .42);
}

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

.sheet-backdrop {
    position: fixed;
    z-index: 20;
    inset: 0;
    background: rgba(14, 31, 23, .35);
    backdrop-filter: blur(2px)
}

.expense-sheet {
    position: fixed;
    z-index: 21;
    bottom: 0;
    left: 50%;
    width: min(560px, 100%);
    max-height: 91dvh;
    padding: 9px 20px max(24px, env(safe-area-inset-bottom));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: #fffdf9;
    border-radius: 27px 27px 0 0;
    box-shadow: 0 -15px 50px rgba(15, 38, 27, .2);
    transform: translate(-50%, 105%);
    transition: transform .32s cubic-bezier(.22, .9, .3, 1)
}

.expense-sheet.open {
    transform: translate(-50%, 0)
}

.sheet-handle {
    width: 39px;
    height: 4px;
    margin: 0 auto 15px;
    border-radius: 4px;
    background: #dae0d7
}

.close-button {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #f0f2ed;
    color: #4a6356;
    font-size: 25px
}

.sheet-header {
    margin-bottom: 18px
}

.photo-picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 94px;
    margin-bottom: 16px;
    border: 1.5px dashed #bdc9bc;
    border-radius: 16px;
    background: #f7faf5;
    color: #557064;
    cursor: pointer
}

.photo-picker span {
    font-size: 22px
}

.photo-picker strong {
    margin-top: 3px;
    font-size: 12px
}

.photo-picker small {
    margin-top: 3px;
    color: #98a49a;
    font-size: 10px
}

.photo-picker.has-image {
    background-size: cover;
    background-position: center;
    color: #fff;
    text-shadow: 0 1px 6px #000
}

.amount-input {
    position: relative;
    display: flex;
    align-items: center;
    height: 77px;
    padding: 13px 15px 4px;
    border: 1.5px solid #e4e8e1;
    border-radius: 16px;
    background: #fff
}

.amount-input:focus-within {
    border-color: #63a070
}

.amount-input span {
    margin-right: 4px;
    font-family: Fraunces, serif;
    font-size: 30px
}

.amount-input input {
    width: 100%;
    padding: 0;
    border: 0;
    outline: 0;
    font-family: Fraunces, serif;
    font-size: 33px
}

.amount-input label {
    position: absolute;
    top: 10px;
    left: 16px;
    color: #94a095;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px
}

.field-label {
    display: block;
    margin-top: 14px;
    color: #839087;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px
}

.field-label input,
.field-label select {
    width: 100%;
    height: 45px;
    margin-top: 5px;
    padding: 0 12px;
    border: 1.5px solid #e4e8e1;
    border-radius: 12px;
    outline: 0;
    background: #fff;
    color: #294136;
    font-size: 13px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px
}

.split-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 19px 1px;
    color: #456054;
    font-size: 12px;
    font-weight: 700
}

.split-toggle input {
    display: none
}

.split-toggle span {
    width: 20px;
    height: 20px;
    border: 1.5px solid #b6c5b8;
    border-radius: 6px
}

.split-toggle input:checked+span {
    border-color: #2d7552;
    background: #2d7552;
    box-shadow: inset 0 0 0 4px #fff
}

.split-toggle em {
    margin-left: auto;
    color: #94a197;
    font-size: 10px;
    font-style: normal
}

.save-button {
    width: 100%;
    height: 53px;
    margin-top: 18px;
    border-radius: 15px;
    background: #204f3c;
    color: #fff;
    font-weight: 700;
    letter-spacing: .1px;
    transition: transform .15s ease, box-shadow .2s ease;
}

.save-button:hover {
    box-shadow: 0 6px 18px rgba(32, 79, 60, .25);
}

.save-button:active {
    transform: scale(.97);
}

.save-button span {
    margin-left: 7px;
    font-size: 18px
}

.toast {
    position: fixed;
    z-index: 30;
    bottom: 95px;
    left: 50%;
    padding: 11px 16px;
    border-radius: 20px;
    background: #183b2d;
    color: #fff;
    font-size: 12px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, 20px) scale(.92);
    transition: opacity .3s ease, transform .4s cubic-bezier(.175, .885, .32, 1.275);
    pointer-events: none
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1)
}

.view-sheet {
    position: fixed;
    z-index: 15;
    right: 14px;
    bottom: 92px;
    left: 14px;
    max-width: 532px;
    margin: auto;
    padding: 20px;
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow)
}

.view-sheet h2 {
    margin: 0;
    font-family: Fraunces, serif
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px
}

.stat {
    padding: 15px;
    border-radius: 14px;
    background: #f5f7f2
}

.stat span {
    display: block;
    color: #7e8b82;
    font-size: 10px;
    font-weight: 700
}

.stat b {
    display: block;
    margin-top: 6px;
    font-size: 20px
}

.friend-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px
}

.friend-line:last-child {
    border: 0
}

@media (min-width:561px) {
    .bottom-nav {
        left: 50%;
        width: 560px;
        transform: translateX(-50%);
        border-radius: 18px 18px 0 0
    }
}

.profile-button {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    border: 2px solid rgba(255, 255, 255, .75);
    border-radius: 50%;
    background: #275640;
    color: #fff;
    font-weight: 700
}

.profile-button span {
    font-size: 13px
}

.locked-field {
    display: flex;
    align-items: center;
    height: 45px;
    margin-top: 5px;
    padding: 0 12px;
    border: 1.5px solid #e4e8e1;
    border-radius: 12px;
    background: #f4f6f1;
    color: #496457;
    font-size: 13px
}

.profile-sheet {
    position: fixed;
    z-index: 22;
    bottom: 0;
    left: 50%;
    width: min(560px, 100%);
    padding: 10px 22px max(28px, env(safe-area-inset-bottom));
    border-radius: 27px 27px 0 0;
    background: #fffdf9;
    box-shadow: 0 -15px 50px rgba(15, 38, 27, .2);
    transform: translate(-50%, 105%);
    transition: transform .32s cubic-bezier(.22, .9, .3, 1)
}

.profile-sheet.open {
    transform: translate(-50%, 0)
}

.profile-sheet h2 {
    margin: 0;
    font-family: Fraunces, serif
}

.profile-sheet>p:not(.tiny-label) {
    margin: 9px 0 17px;
    color: #718077;
    font-size: 13px;
    line-height: 1.5
}

.profile-sheet input {
    width: 100%;
    height: 50px;
    padding: 0 14px;
    border: 1.5px solid #dfe6de;
    border-radius: 13px;
    outline: 0;
    font-size: 15px
}

.profile-sheet input:focus {
    border-color: #5d9a6b
}

.profile-sheet .save-button {
    margin-top: 14px
}

.or-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 0;
    color: #9aa49c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px
}

.or-divider:before,
.or-divider:after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e7ebe5
}

.outline-button {
    width: 100%;
    height: 48px;
    margin-top: 13px;
    border: 1.5px solid #285942;
    border-radius: 14px;
    background: #fff;
    color: #285942;
    font-weight: 700;
    transition: background .2s ease, color .2s ease;
}

.outline-button:hover {
    background: #285942;
    color: #fff;
}

.outline-button:active {
    transform: scale(.97);
}

/* ===== Refresh Button ===== */
.refresh-button {
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    color: #355346;
    font-size: 18px;
    transition: transform .3s ease;
}

.refresh-button.spinning {
    animation: spin .6s ease;
}

/* ===== Skeleton Loading ===== */
.skeleton-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid #f0f0eb;
    border-radius: 18px;
}

.skeleton-circle {
    width: 47px;
    height: 47px;
    border-radius: 15px;
    background: linear-gradient(90deg, #f0f2ed 25%, #e4e8e1 50%, #f0f2ed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
    flex-shrink: 0;
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f2ed 25%, #e4e8e1 50%, #f0f2ed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
}

.skeleton-line:first-child {
    width: 70%;
}

.skeleton-line:last-child {
    width: 45%;
}

.skeleton-amount {
    width: 55px;
    height: 16px;
    border-radius: 6px;
    background: linear-gradient(90deg, #f0f2ed 25%, #e4e8e1 50%, #f0f2ed 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
    flex-shrink: 0;
}

/* ===== Pulse Value Animation ===== */
.pulse-value {
    animation: pulseValue .5s cubic-bezier(.22, .9, .3, 1);
}

/* ===== View Sheet Animation ===== */
.view-sheet {
    position: fixed;
    z-index: 15;
    right: 14px;
    bottom: 92px;
    left: 14px;
    max-width: 532px;
    margin: auto;
    padding: 20px;
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--shadow);
    animation: popIn .3s cubic-bezier(.22, .9, .3, 1);
}

/* ===== Date Label Animation ===== */
.date-label {
    margin: 21px 0 9px;
    color: #879188;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .9px;
    animation: fadeIn .3s ease;
}

/* ===== Keyframes ===== */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseValue {
    0% { transform: scale(1); }
    40% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

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

@keyframes floatSparkle {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: .7; }
    50% { transform: translateY(-10px) rotate(15deg); opacity: 1; }
}

@keyframes sunPulse {
    0%, 100% { transform: scale(1); opacity: .66; }
    50% { transform: scale(1.06); opacity: .8; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ===== Section Heading Buttons ===== */
.section-heading-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}