body {
    background:
        radial-gradient(circle at top left, rgba(244, 63, 94, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(14, 165, 233, 0.14), transparent 28%),
        linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.glass-card {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(20px);
}

.save-toast {
    position: fixed;
    top: 0.7rem;
    left: 0.7rem;
    z-index: 60;
    max-width: min(18rem, calc(100vw - 1.4rem));
    padding: 0.45rem 0.7rem;
    border: 1px solid rgb(226 232 240 / 0.9);
    border-radius: 9999px;
    background: rgb(255 255 255 / 0.92);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px -18px rgb(15 23 42 / 0.45);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    pointer-events: none;
}

.save-toast-info {
    color: rgb(71 85 105);
}

.save-toast-success {
    border-color: rgb(167 243 208 / 0.95);
    background: rgb(236 253 245 / 0.96);
    color: rgb(5 150 105);
}

.save-toast-error {
    border-color: rgb(254 205 211 / 0.95);
    background: rgb(255 241 242 / 0.96);
    color: rgb(225 29 72);
}

.summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr) minmax(0, 1fr);
    gap: 0.35rem;
    align-items: stretch;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.stats-card {
    position: relative;
    overflow: hidden;
    border-width: 1px;
    border-radius: 1.1rem;
    padding: 0.7rem 0.65rem;
    min-width: 0;
    text-align: center;
}

.stats-card > * {
    position: relative;
    z-index: 1;
}

.stats-card-label {
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.stats-card-value {
    margin-top: 0.35rem;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.15;
}

.summary-card {
    border-width: 1px;
    border-radius: 9999px;
    padding: 0.34rem 0.55rem;
    min-width: 0;
    width: 100%;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.18rem;
}

.summary-card-burned {
    min-width: 0;
}

.summary-card-burned .summary-input-row {
    justify-content: center;
}

.summary-card-burned .summary-input {
    width: 4.4rem;
    flex-basis: 4.4rem;
    text-align: center;
}

.summary-card-centered {
    align-items: center;
    text-align: center;
}

.summary-card-centered .summary-label,
.summary-card-centered .summary-value {
    width: 100%;
    text-align: center;
}

.summary-card-centered .summary-value {
    padding-top: 0.3rem;
}

.difference-positive,
.difference-negative {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.difference-positive::after,
.difference-negative::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0.28;
}

.difference-positive::after {
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 7px,
        rgb(225 29 72 / 0.14) 7px 9px
    );
}

.difference-negative::after {
    background-image: repeating-linear-gradient(
        135deg,
        transparent 0 7px,
        rgb(5 150 105 / 0.14) 7px 9px
    );
}

.difference-positive > *,
.difference-negative > * {
    position: relative;
    z-index: 1;
}

.summary-label {
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.summary-value {
    margin-top: 0;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.summary-input-row {
    display: inline-flex;
    align-items: center;
    gap: 0.24rem;
    margin-top: 0;
    max-width: 100%;
    min-height: 1.3rem;
    padding: 0.05rem 0.3rem;
    border: 1px solid rgb(251 113 133 / 0.18);
    border-radius: 9999px;
    background: rgb(255 255 255 / 0.72);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.92);
    white-space: nowrap;
    align-self: stretch;
}

.summary-input-row:focus-within {
    border-color: rgb(251 113 133 / 0.45);
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.92),
        0 0 0 3px rgb(254 205 211 / 0.35);
}

.summary-input-prefix,
.summary-input-suffix {
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.summary-input {
    width: 3.1rem;
    flex: 0 1 3.1rem;
    min-width: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    text-align: right;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.summary-input:focus {
    outline: none;
    box-shadow: none;
}

.summary-input::placeholder {
    color: rgb(136 19 55 / 0.55);
}

@media (min-width: 640px) {
    .summary-row {
        gap: 0.5rem;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr) minmax(0, 1fr);
    }

    .stats-grid {
        gap: 0.65rem;
    }

    .stats-card {
        padding: 0.8rem 0.85rem;
    }

    .stats-card-label {
        font-size: 0.66rem;
    }

    .stats-card-value {
        font-size: 0.98rem;
    }

    .summary-card {
        padding: 0.38rem 0.75rem;
        gap: 0.24rem;
    }

    .summary-label {
        font-size: 0.64rem;
    }

    .summary-value,
    .summary-input {
        font-size: 0.88rem;
    }

    .summary-input-row {
        gap: 0.32rem;
        min-height: 1.45rem;
        padding: 0.06rem 0.4rem;
    }

    .summary-input-prefix,
    .summary-input-suffix {
        font-size: 0.69rem;
    }

    .summary-input {
        width: 4.2rem;
        flex-basis: 4.2rem;
    }

    .summary-card-burned .summary-input {
        width: 5.2rem;
        flex-basis: 5.2rem;
    }
}

.entry-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    border: 1px solid rgb(226 232 240 / 0.8);
    border-radius: 1.25rem;
    background: rgb(255 255 255 / 0.8);
    padding: 0.62rem 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
    transition: border-color 150ms ease;
}

.entry-row:hover {
    border-color: rgb(203 213 225);
}

.entry-row-icon {
    display: inline-flex;
    height: 2rem;
    width: 2rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 0.85rem;
    background: rgb(241 245 249);
    color: rgb(71 85 105);
}

.entry-row-title {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: rgb(30 41 59);
}

.entry-row-subtitle {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    color: rgb(100 116 139);
}

.entry-row-label-input,
.entry-row-kcal,
.entry-row-remove {
    border: 1px solid rgb(226 232 240);
    background: white;
    box-shadow: 0 1px 2px 0 rgb(15 23 42 / 0.05);
}

.entry-row-label-input {
    display: block;
    width: 100%;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: rgb(30 41 59);
}

.entry-row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-left: auto;
}

.entry-row-kcal {
    width: 5.75rem;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
    color: rgb(30 41 59);
}

.meal-kcal-field,
.extra-label-field,
.extra-kcal-field {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgb(255 255 255) 0%, rgb(248 250 252) 100%);
    padding: 0 0.75rem;
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.95),
        0 10px 25px -20px rgb(15 23 42 / 0.28);
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.meal-kcal-field,
.extra-kcal-field {
    min-width: 6.6rem;
}

.extra-label-field {
    flex: 1 1 14rem;
    min-width: 0;
    justify-content: flex-start;
    padding: 0 0.75rem;
}

.meal-kcal-field:hover,
.extra-label-field:hover,
.extra-kcal-field:hover {
    border-color: rgb(203 213 225);
}

.meal-kcal-field:focus-within,
.extra-label-field:focus-within,
.extra-kcal-field:focus-within {
    border-color: rgb(251 113 133);
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / 0.95),
        0 0 0 3px rgb(254 205 211 / 0.65);
}

.meal-kcal-field[data-filled='true'],
.extra-kcal-field[data-filled='true'] {
    border-color: rgb(167 243 208);
    background: linear-gradient(180deg, rgb(255 255 255) 0%, rgb(236 253 245) 100%);
}

.meal-kcal-check {
    display: inline-flex;
    width: 0;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    color: rgb(5 150 105);
    opacity: 0;
    transform: scale(0.7);
    transition: width 150ms ease, opacity 150ms ease, transform 150ms ease, margin 150ms ease;
}

.meal-kcal-field[data-filled='true'] .meal-kcal-check,
.extra-kcal-field[data-filled='true'] .meal-kcal-check {
    width: 0.95rem;
    opacity: 1;
    transform: scale(1);
}

.meal-kcal-input {
    width: 4rem;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0.55rem 0;
    text-align: right;
    font-size: 0.9rem;
}

.meal-kcal-input:focus {
    outline: none;
    box-shadow: none;
}

.extra-row {
    flex-wrap: nowrap;
    gap: 0.5rem;
}

.extra-row-actions {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

.extra-label-input,
.extra-kcal-input {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: rgb(30 41 59);
}

.extra-label-input {
    width: 100%;
    padding: 0.55rem 0;
    font-size: 0.82rem;
}

.extra-kcal-field {
    min-width: 6.4rem;
    flex-shrink: 0;
    justify-content: flex-end;
}

.extra-kcal-input {
    width: 3.85rem;
    padding: 0.55rem 0;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 600;
}

.extra-label-input:focus,
.extra-kcal-input:focus {
    outline: none;
    box-shadow: none;
}

.entry-row-remove-compact {
    height: 2.05rem;
    width: 2.05rem;
    padding: 0;
    border-radius: 9999px;
}

.entry-row-remove-symbol {
    display: inline-block;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 500;
}

.entry-row-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(100 116 139);
    transition: 150ms ease;
}

.entry-row-remove:hover {
    border-color: rgb(254 205 211);
    background: rgb(255 241 242);
    color: rgb(225 29 72);
}

.entry-row-remove-danger {
    border-color: rgb(254 205 211);
    background: rgb(255 241 242);
    color: rgb(225 29 72);
}

.entry-row-remove-danger:hover {
    border-color: rgb(251 113 133);
    background: rgb(255 228 230);
    color: rgb(190 18 60);
}

.date-nav-button {
    display: inline-flex;
    height: 1.55rem;
    width: 1.55rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 1px solid rgb(226 232 240);
    background: white;
    color: rgb(51 65 85);
    font-size: 0.8rem;
    transition: 150ms ease;
}

@media (min-width: 640px) {
    .date-nav-button {
        height: 1.75rem;
        width: 1.75rem;
    }
}

.date-nav-button:hover {
    transform: translateY(-1px);
    color: rgb(15 23 42);
}

.kcal-input::-webkit-outer-spin-button,
.kcal-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.kcal-input[type='number'] {
    -moz-appearance: textfield;
}