:root {
    --cream-bg: #fff8ee;
    --card-bg: #ffffff;
    --peach: #ff8fa3;
    --peach-dark: #e96f86;
    --orange: #ffc46b;
    --purple: #c9b6ff;
    --brown: #4b3328;
    --muted: #8b7065;
    --line: #f3dfd2;
    --shadow: 0 14px 38px rgba(115, 76, 55, 0.13);
    --radius-lg: 24px;
    --radius-md: 18px;
    /* 补充未定义的变量 */
    --primary: var(--peach);
    --pink: var(--peach);
    --shadow-sm: 0 4px 12px rgba(115, 76, 55, 0.08);
    --bg: var(--cream-bg);
    --border: var(--line);
    --text: var(--brown);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 196, 107, 0.24), transparent 30rem),
        var(--cream-bg);
    color: var(--brown);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    line-height: 1.55;
}

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

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

button {
    cursor: pointer;
}

button:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.app-shell {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 18px 16px 96px;
}

.page-content {
    display: grid;
    gap: 16px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.topbar h1,
.hero-card h2,
.brand-card h1,
.section-title h2 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--peach-dark);
    font-size: 13px;
    font-weight: 700;
}

.muted,
.empty-text {
    color: var(--muted);
}

.card,
.hero-card,
.brand-card,
.stat-card,
.quick-link,
.list-card {
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.hero-card,
.brand-card {
    padding: 22px;
}

.hero-card {
    background: linear-gradient(135deg, #fff, #fff2e2);
}

.hero-card.compact {
    display: grid;
    gap: 8px;
}

.card {
    padding: 18px;
}

.login-screen {
    min-height: 86vh;
    display: grid;
    align-content: center;
    gap: 18px;
}

.brand-card h1,
.hero-card h2 {
    font-size: 28px;
    line-height: 1.18;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.compact-add-card {
    gap: 10px;
    padding: 12px;
}

.compact-add-card label {
    gap: 5px;
    font-size: 14px;
}

.compact-add-card input,
.compact-add-card select {
    min-height: 40px;
    border-radius: 14px;
    padding: 9px 12px;
}

.compact-submit {
    min-height: 44px;
    padding: 10px 14px;
}

.quick-add-panel {
    padding: 0;
    overflow: hidden;
}

.quick-add-panel summary {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    color: var(--brown);
    cursor: pointer;
    font-weight: 900;
    list-style: none;
}

.quick-add-panel summary::-webkit-details-marker {
    display: none;
}

.quick-add-panel .form-grid {
    padding: 0 12px 12px;
}

.quick-add-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: #ffe4ea;
    color: var(--peach-dark);
}

.quick-add-panel[open] .quick-add-icon {
    transform: rotate(45deg);
}

label {
    display: grid;
    gap: 7px;
    color: var(--brown);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffdf8;
    color: var(--brown);
    outline: none;
    padding: 13px 14px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--peach);
    box-shadow: 0 0 0 4px rgba(255, 143, 163, 0.18);
}

.primary-button,
.ghost-button,
.mini-form button,
.inline-pill,
.chip-button {
    border: 0;
    border-radius: 999px;
    font-weight: 800;
}

.primary-button {
    width: 100%;
    background: var(--peach);
    color: #fff;
    padding: 14px 18px;
    box-shadow: 0 10px 22px rgba(233, 111, 134, 0.28);
}

.primary-button:active,
.quick-link:active,
.bottom-nav a:active {
    transform: translateY(1px);
}

.ghost-button {
    background: rgba(255, 255, 255, 0.7);
    color: var(--brown);
    padding: 10px 14px;
}

.ghost-button.small {
    flex: 0 0 auto;
    padding: 8px 12px;
}

.form-message {
    min-height: 22px;
    margin: 0;
    color: var(--peach-dark);
}

.segmented-field {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.segmented-field legend {
    grid-column: 1 / -1;
    margin-bottom: 2px;
    font-weight: 700;
}

.segmented-field label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fffdf8;
}

.identity-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 8px 0;
}

.identity-selector legend {
    text-align: center;
    margin-bottom: 12px;
}

.identity-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.identity-option input {
    display: none;
}

.identity-icon {
    width: 100%;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    font-size: 17px;
    font-weight: 900;
    line-height: 1;
    color: var(--muted);
    opacity: 0.5;
    transition: transform 0.2s, opacity 0.2s;
}

.identity-hint {
    margin: -4px 0 0;
    font-size: 13px;
    text-align: center;
}

.identity-option input:checked + .identity-icon {
    opacity: 1;
    transform: scale(1.04);
    border-color: var(--brown);
    background: var(--brown);
    color: #fff;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.compact-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.stat-card {
    padding: 16px;
}

.compact-stats .stat-card {
    padding: 12px;
}

.stat-filter {
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: left;
}

.stat-filter.active {
    border-color: var(--peach);
    background: #ffe9ee;
    box-shadow: 0 12px 28px rgba(233, 111, 134, 0.18);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat-card strong {
    display: block;
    margin-top: 4px;
    font-size: 24px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.quick-link {
    min-height: 94px;
    display: flex;
    align-items: flex-end;
    padding: 16px;
    font-weight: 900;
}

.quick-link.peach {
    background: #ffe0e7;
}

.quick-link.orange {
    background: #fff0cd;
}

.quick-link.purple {
    background: #eee7ff;
}

.quick-link.cream {
    background: #fffaf0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.section-title h2 {
    font-size: 18px;
}

.section-title a,
.inline-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff3df;
    color: var(--brown);
    padding: 8px 12px;
    font-size: 13px;
}

.tab-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.two-tab-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.switch-card {
    padding: 12px;
}

.tab-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #fff3df;
    color: var(--muted);
    font-weight: 900;
    font-size: 14px;
}

.tab-button.active {
    background: var(--peach);
    color: #fff;
    box-shadow: 0 10px 20px rgba(233, 111, 134, 0.22);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: grid;
    gap: 16px;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 8px 0 4px;
}

.todo-filter-card {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 8px 22px rgba(115, 76, 55, 0.08);
}

.todo-filter-card .section-title {
    margin-bottom: 6px;
}

.todo-filter-card .section-title h2 {
    font-size: 15px;
}

.todo-filter-bar {
    display: grid;
    gap: 6px;
}

.todo-filter-selects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 6px;
}

.todo-filter-bar input,
.todo-filter-bar select {
    min-height: 36px;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
}

.compact-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.compact-field-row label {
    min-width: 0;
}

.list-section {
    display: grid;
    gap: 12px;
}

.list-section.inner {
    margin-top: 12px;
}

.list-card {
    padding: 16px;
}

.todo-card {
    padding: 12px;
}

.list-card.done {
    opacity: 0.72;
}

.list-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.list-card p {
    margin: 4px 0;
    color: var(--muted);
}

.history-card {
    display: grid;
    gap: 10px;
}

.todo-card {
    display: grid;
    gap: 8px;
}

.todo-card.expanded {
    border-color: rgba(255, 143, 163, 0.45);
}

.todo-main {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.todo-title {
    min-width: 0;
}

.todo-title h3 {
    margin-bottom: 2px;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.todo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 0;
    font-size: 12px;
    line-height: 1.3;
}

.todo-meta span + span::before {
    content: "/";
    margin-right: 8px;
    color: #c8aa9a;
}

.todo-check {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: #fffaf0;
    color: #fff;
    font-weight: 900;
}

.todo-check.checked {
    border-color: var(--peach);
    background: var(--peach);
}

.todo-main > .chip-button {
    padding: 7px 10px;
    white-space: nowrap;
}

.shopping-row .todo-main {
    grid-template-columns: 36px minmax(0, 1fr) auto;
}

.todo-controls {
    grid-template-columns: 1fr auto;
    align-items: end;
}

.todo-controls .chip-button {
    min-height: 52px;
}

.todo-manage {
    display: grid;
    gap: 10px;
    margin-top: 4px;
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-md);
    background: #fffaf0;
}

.primary-chip {
    background: var(--peach);
    color: #fff;
}

.dish-card {
    display: grid;
    gap: 14px;
    padding: 12px;
}

.dish-card.compact {
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: stretch;
}

.dish-card-body {
    padding: 4px;
    min-width: 0;
}

.dish-image,
.dish-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 20px;
    object-fit: cover;
    background: #fff3df;
}

.dish-image-button {
    width: 100%;
    border: 0;
    border-radius: 20px;
    background: transparent;
    padding: 0;
    overflow: hidden;
}

.dish-image-button:focus-visible {
    outline: 4px solid rgba(255, 143, 163, 0.35);
    outline-offset: 3px;
}

.dish-image.placeholder,
.dish-preview {
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    color: var(--muted);
    font-weight: 800;
}

.dish-card.compact .dish-image {
    height: 100%;
    min-height: 112px;
    aspect-ratio: auto;
    border-radius: 18px;
    font-size: 13px;
    text-align: center;
    padding: 8px;
}

.dish-card.compact .dish-image-button {
    height: 100%;
    min-height: 112px;
}

.dish-card.compact h3,
.compact-line {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dish-card.compact h3 {
    white-space: nowrap;
}

.compact-line {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.compact-tags {
    max-height: 78px;
    overflow: hidden;
}

.dish-preview {
    overflow: hidden;
}

.dish-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-lightbox[hidden] {
    display: none;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(75, 51, 40, 0.72);
}

.image-lightbox img {
    max-width: min(100%, 920px);
    max-height: 82vh;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 20px 54px rgba(0, 0, 0, 0.24);
    object-fit: contain;
}

.image-lightbox-close {
    position: fixed;
    top: 18px;
    right: 18px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--brown);
    padding: 10px 14px;
    font-weight: 900;
}

.tag-row,
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #fff4e1;
    color: var(--brown);
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
}

.chip-button {
    background: #f7e9df;
    color: var(--brown);
    padding: 8px 12px;
}

.chip-button.danger {
    background: #ffe5e8;
    color: #ad4256;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.file-picker {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fffdf8;
    padding: 8px;
    cursor: pointer;
}

.file-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--peach);
    color: #fff;
    padding: 10px 14px;
    font-weight: 900;
    white-space: nowrap;
}

.file-picker-name {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mini-form {
    display: grid;
    gap: 10px;
}

.mini-form button {
    background: var(--orange);
    color: var(--brown);
    padding: 12px 14px;
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 14px;
    z-index: 10;
    width: min(calc(100% - 24px), 720px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 34px rgba(115, 76, 55, 0.18);
    transform: translateX(-50%);
    backdrop-filter: blur(12px);
}

.bottom-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
}

.bottom-nav a.active {
    background: var(--peach);
    color: #fff;
}

@media (min-width: 720px) {
    .app-shell {
        padding-top: 28px;
    }

    .stat-grid,
    .quick-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .select-row,
    .mini-form,
    .filter-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
    }

    .filter-bar:has(select:nth-of-type(3)) {
        grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
    }

    .todo-controls {
        grid-template-columns: 1fr auto;
    }

    .mini-form button {
        min-height: 50px;
    }

    .dish-card {
        grid-template-columns: 220px 1fr;
        align-items: stretch;
    }

    .dish-card.compact {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .dish-image {
        height: 100%;
        min-height: 180px;
        aspect-ratio: auto;
    }

    .dish-card.compact .dish-image {
        min-height: 132px;
    }

    .dish-card.compact .dish-image-button {
        min-height: 132px;
    }
}

/* ===== Calendar ===== */
.calendar-nav {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    align-items: center;
    column-gap: 12px;
    padding: 8px 0;
}

.calendar-nav h2 {
    margin: 0;
    font-size: 20px;
}

.calendar-nav button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
}

.calendar-nav button:hover {
    background: #ffe9ee;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 12px;
    font-weight: 900;
    color: var(--muted);
    padding: 8px 0;
}

.calendar-weekdays span:nth-child(1),
.calendar-weekdays span:nth-child(7) {
    color: var(--peach-dark);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    min-height: 60px;
    padding: 6px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day:hover {
    background: #ffe9ee;
}

.calendar-day.other-month {
    opacity: 0.35;
}

.calendar-day.today {
    border: 2px solid var(--peach);
}

.calendar-day.selected {
    background: #fff3df;
}

.day-number {
    font-size: 14px;
    font-weight: 900;
}

.event-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.event-dot {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    font-size: 10px;
    display: grid;
    place-items: center;
}

.event-dot.dot-male {
    background: #d0e8ff;
    color: #3b82f6;
}

.event-dot.dot-female {
    background: #fdd5e8;
    color: #ec4899;
}

.calendar-events-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.calendar-event-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    padding-left: 16px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border-left: 3px solid var(--peach);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.calendar-event-card.female {
    border-left-color: var(--pink);
}

.calendar-event-card .event-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.calendar-event-card .event-title {
    font-weight: 500;
}

.calendar-event-card .event-time {
    font-size: 12px;
    color: var(--muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.calendar-event-card .event-creator-icon {
    font-size: 14px;
}

.calendar-event-card .delete-btn {
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
}

.calendar-event-card .delete-btn:hover {
    color: #ef4444;
}

/* Date picker modal */
.date-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.date-modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.date-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.date-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    background: var(--bg);
    border-radius: 50%;
    font-size: 18px;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
    background: var(--border);
}

/* Modal form styles */
.date-modal-content form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.date-modal-content .compact-field-row {
    display: flex;
    gap: 8px;
}

.date-modal-content input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg);
}

.date-modal-content input:focus {
    outline: none;
    border-color: var(--peach);
}

.date-modal-content .primary-button.compact-submit {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 15px;
}

@media (max-width: 480px) {
    .date-modal {
        align-items: flex-end;
        padding: 0;
    }

    .date-modal-content {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }
}

/* === 首页：今日最重要卡片 === */
.priority-card {
    padding: 20px;
    background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
    border-top: 3px solid var(--peach);
}

.priority-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--peach-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px;
}

.priority-text {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 12px;
    color: var(--brown);
}

.priority-action {
    display: inline-block;
    padding: 8px 16px;
    font-size: 14px;
}

/* === 首页：小家状态横条 === */
.status-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.status-icon {
    font-size: 20px;
}

.status-label {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}

.status-value {
    font-size: 16px;
    font-weight: 800;
    color: var(--brown);
}

/* === 首页：便签预览卡片 === */
.note-preview-card {
    background: #fffdf8;
}

.note-sticky {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: #fffdf8;
    border-top: 3px solid var(--peach);
    box-shadow: 0 2px 8px rgba(115, 76, 55, 0.08);
}

.note-author {
    font-size: 13px;
    font-weight: 700;
    color: var(--peach-dark);
    margin: 0 0 6px;
}

.note-content {
    font-size: 15px;
    margin: 0 0 8px;
    line-height: 1.5;
}

.note-mood,
.note-time {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

/* === 我们页：爱心值区域 === */
.love-section {
    display: grid;
    gap: 12px;
}

.love-total {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #ffe0e7 0%, #fff0cd 100%);
    border-radius: var(--radius-lg);
    text-align: center;
}

.love-total-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--peach-dark);
}

.love-total-value {
    font-size: 36px;
    font-weight: 900;
    color: var(--peach-dark);
}

/* === 我们页：心情选择 === */
.mood-section .section-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--brown);
    margin: 0 0 12px;
}

.mood-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.mood-chip {
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fffdf8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.mood-chip:hover {
    border-color: var(--peach);
    background: #ffe0e7;
}

.mood-chip.selected {
    background: var(--peach);
    color: #fff;
    border-color: var(--peach);
}

/* === 响应式 === */
@media (max-width: 480px) {
    .status-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .love-total {
        flex-direction: column;
        gap: 8px;
    }
}

/* === Whole app visual refinement === */
:root {
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --surface-soft: #fff3df;
    --ink-soft: #6f5245;
    --accent-blue: #8fb8d9;
    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow: 0 12px 30px rgba(75, 51, 40, 0.1);
    --shadow-sm: 0 6px 16px rgba(75, 51, 40, 0.07);
    --shadow-pop: 0 20px 54px rgba(75, 51, 40, 0.18);
}

body {
    background:
        linear-gradient(180deg, #fff8ee 0%, #fffaf4 42%, #fff4e8 100%);
    color: var(--brown);
    text-wrap: pretty;
}

.app-shell {
    width: min(100%, 820px);
    padding: 20px 16px 104px;
}

.page-content {
    gap: 14px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: -6px -4px 14px;
    padding: 8px 4px 10px;
    background: linear-gradient(180deg, rgba(255, 248, 238, 0.96), rgba(255, 248, 238, 0));
    backdrop-filter: blur(10px);
}

.topbar h1 {
    font-size: 22px;
    line-height: 1.15;
}

.eyebrow,
.calendar-kicker,
.section-label {
    letter-spacing: 0.04em;
}

.card,
.hero-card,
.brand-card,
.stat-card,
.quick-link,
.list-card {
    border: 1px solid rgba(243, 223, 210, 0.84);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow-sm);
}

.hero-card,
.brand-card {
    display: grid;
    gap: 8px;
    padding: 22px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 243, 223, 0.92));
    box-shadow: var(--shadow);
}

.brand-card h1,
.hero-card h2 {
    font-size: clamp(25px, 5vw, 34px);
    letter-spacing: 0;
}

.hero-card .muted,
.brand-card .muted {
    margin: 0;
}

.card {
    padding: 16px;
}

.primary-button,
.ghost-button,
.chip-button,
.tab-button,
.inline-pill,
.quick-link,
.calendar-nav button,
.todo-check,
.mood-chip {
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.primary-button:hover,
.quick-link:hover,
.chip-button:hover,
.tab-button:hover,
.calendar-nav button:hover,
.mood-chip:hover {
    transform: translateY(-1px);
}

.primary-button:focus-visible,
.ghost-button:focus-visible,
.chip-button:focus-visible,
.tab-button:focus-visible,
.quick-link:focus-visible,
.bottom-nav a:focus-visible,
.calendar-day:focus-visible,
.modal-close:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(255, 143, 163, 0.28);
    outline-offset: 3px;
}

.primary-button {
    min-height: 48px;
    background: var(--brown);
    box-shadow: 0 12px 24px rgba(75, 51, 40, 0.18);
}

.primary-button:hover {
    background: #5d3f32;
}

.ghost-button,
.chip-button,
.inline-pill {
    border: 1px solid rgba(243, 223, 210, 0.96);
    background: var(--surface);
}

.chip-button.danger {
    background: #fff0f2;
    color: #a63f52;
}

input,
select,
textarea {
    min-height: 46px;
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, 0.95);
}

.section-title {
    margin-bottom: 10px;
}

.section-title h2 {
    font-size: 17px;
    line-height: 1.2;
}

.bottom-nav {
    bottom: 12px;
    width: min(calc(100% - 20px), 680px);
    gap: 4px;
    padding: 6px;
    border-color: rgba(243, 223, 210, 0.9);
    border-radius: 24px;
}

.bottom-nav a {
    min-height: 44px;
    border-radius: 18px;
    font-size: 13px;
}

.bottom-nav a.active {
    background: var(--brown);
}

.quick-grid {
    gap: 10px;
}

.quick-link {
    min-height: 82px;
    align-items: flex-start;
    justify-content: space-between;
    border-color: rgba(243, 223, 210, 0.72);
    padding: 14px;
    font-size: 16px;
}

.quick-link::after {
    content: "->";
    color: rgba(75, 51, 40, 0.42);
    font-weight: 900;
}

.stat-card {
    padding: 14px;
}

.stat-card span {
    font-size: 12px;
}

.stat-card strong {
    font-size: 26px;
    line-height: 1.05;
}

.stat-filter {
    cursor: pointer;
}

.stat-filter.active {
    border-color: rgba(75, 51, 40, 0.2);
    background: #fff0cd;
    box-shadow: 0 10px 24px rgba(75, 51, 40, 0.1);
}

.tab-bar {
    gap: 6px;
}

.tab-button {
    min-height: 42px;
    background: var(--surface);
    color: var(--ink-soft);
}

.tab-button.active {
    background: var(--brown);
    color: #fff;
    box-shadow: 0 10px 22px rgba(75, 51, 40, 0.16);
}

.todo-filter-card,
.switch-card,
.quick-add-panel {
    box-shadow: none;
}

.quick-add-panel summary {
    min-height: 48px;
}

.quick-add-icon {
    background: var(--brown);
    color: #fff;
}

.list-section {
    gap: 10px;
}

.list-card {
    padding: 14px;
}

.list-card h3 {
    font-size: 17px;
    line-height: 1.25;
}

.todo-card {
    border-color: rgba(243, 223, 210, 0.9);
    box-shadow: none;
}

.todo-card.expanded {
    background: #fffaf0;
    box-shadow: var(--shadow-sm);
}

.todo-main {
    grid-template-columns: 38px minmax(0, 1fr) auto;
}

.todo-check {
    width: 38px;
    height: 38px;
    background: var(--surface);
}

.todo-check.checked {
    border-color: var(--brown);
    background: var(--brown);
}

.tag {
    background: #fff5e6;
    color: var(--ink-soft);
    font-size: 12px;
}

.dish-card.compact {
    border-radius: 18px;
}

.dish-image,
.dish-preview,
.dish-image-button {
    border-radius: 16px;
}

.file-picker {
    border-radius: var(--radius-md);
}

.file-picker-button {
    background: var(--brown);
}

.status-row {
    gap: 10px;
}

.status-item {
    border: 1px solid rgba(243, 223, 210, 0.84);
    border-radius: 18px;
    box-shadow: none;
}

.status-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--brown);
    font-size: 13px;
    font-weight: 900;
}

.priority-card {
    border-top: 0;
    background: var(--brown);
    color: #fff;
}

.priority-card .priority-label {
    color: var(--orange);
}

.priority-card .priority-text {
    color: #fff;
}

.priority-card .ghost-button {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.note-sticky {
    border: 1px solid rgba(243, 223, 210, 0.9);
    border-top: 0;
    border-radius: 18px;
    box-shadow: none;
}

.note-sticky.mood-happy,
.note-sticky.mood-hug {
    background: #fff0f3;
}

.note-sticky.mood-tired,
.note-sticky.mood-food {
    background: #fff7e8;
}

.note-sticky.mood-comfort {
    background: #f5f1ff;
}

.love-total {
    justify-content: space-between;
    background: var(--brown);
    color: #fff;
}

.love-total-label,
.love-total-value {
    color: #fff;
}

.mood-chip {
    border-radius: 14px;
}

.mood-chip.selected {
    background: var(--brown);
    border-color: var(--brown);
}

/* === Refined calendar === */
.calendar-panel {
    display: grid;
    gap: 12px;
    border: 1px solid rgba(243, 223, 210, 0.86);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
    padding: 14px;
}

.calendar-nav {
    padding: 0;
}

.calendar-nav > div {
    min-height: 88px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.calendar-nav h2 {
    font-size: clamp(24px, 5vw, 34px);
    line-height: 1.05;
}

.calendar-kicker {
    margin: 0 0 4px;
    color: var(--peach-dark);
    font-size: 11px;
    font-weight: 900;
}

.calendar-summary {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.calendar-nav button {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(243, 223, 210, 0.92);
    background: var(--surface);
    box-shadow: none;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0 2px;
}

.calendar-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.legend-dot,
.event-dot {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 999px;
}

.legend-dot.me,
.event-dot.dot-me {
    background: var(--accent-blue);
}

.legend-dot.her,
.event-dot.dot-her {
    background: var(--peach);
}

.calendar-weekdays {
    padding: 4px 2px;
    color: var(--ink-soft);
}

.calendar-grid {
    gap: 6px;
}

.calendar-day {
    min-height: 74px;
    border: 1px solid rgba(243, 223, 210, 0.72);
    border-radius: 16px;
    background: rgba(255, 253, 248, 0.82);
    padding: 8px;
    gap: 8px;
    box-shadow: none;
    outline: none;
}

.calendar-day:hover {
    border-color: rgba(255, 143, 163, 0.55);
    background: #fff7ed;
    transform: translateY(-1px);
}

.calendar-day.other-month {
    opacity: 0.4;
}

.calendar-day.today {
    border: 2px solid var(--brown);
    background: #fff0cd;
}

.calendar-day.selected {
    border-color: var(--peach);
    background: #ffe9ee;
    box-shadow: inset 0 0 0 1px rgba(255, 143, 163, 0.24);
}

.calendar-day.has-events {
    background: #fffdf8;
}

.day-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
}

.day-number {
    font-size: 15px;
}

.day-event-count,
.event-more {
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
}

.event-dots {
    min-height: 10px;
    align-items: center;
}

.calendar-events-list {
    gap: 10px;
}

.calendar-event-card {
    align-items: stretch;
    border: 1px solid rgba(243, 223, 210, 0.9);
    border-left: 0;
    border-radius: 18px;
    box-shadow: none;
    padding: 12px;
}

.calendar-event-card::before {
    content: "";
    width: 5px;
    align-self: stretch;
    border-radius: 999px;
    background: var(--accent-blue);
}

.calendar-event-card.female::before {
    background: var(--peach);
}

.calendar-event-card .event-info {
    min-width: 0;
}

.calendar-event-card .event-title {
    display: block;
    color: var(--brown);
    font-weight: 900;
    line-height: 1.3;
}

.calendar-event-card .event-time {
    display: inline-flex;
    margin-top: 4px;
    background: #fff3df;
}

.calendar-event-card .event-creator-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--brown);
    font-size: 12px;
    font-weight: 900;
}

.calendar-event-card .delete-btn {
    flex: 0 0 auto;
    border-radius: 999px;
}

.date-modal {
    background: rgba(75, 51, 40, 0.42);
    backdrop-filter: blur(8px);
}

.date-modal-content {
    max-width: 440px;
    border: 1px solid rgba(243, 223, 210, 0.88);
    border-radius: 24px;
    box-shadow: var(--shadow-pop);
}

.date-modal-header {
    align-items: flex-start;
}

.date-modal-header h3 {
    font-weight: 900;
}

.date-modal-content form {
    border-top-color: rgba(243, 223, 210, 0.9);
}

.date-modal-content .compact-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.date-modal-content input {
    background: var(--surface);
}

@media (min-width: 720px) {
    .app-shell {
        padding-bottom: 24px;
    }

    .calendar-panel {
        padding: 18px;
    }

    .bottom-nav {
        position: static;
        width: min(100% - 32px, 680px);
        margin: 16px auto 24px;
        transform: none;
    }

    .calendar-grid {
        gap: 8px;
    }

    .calendar-day {
        min-height: 92px;
        padding: 10px;
    }
}

@media (max-width: 520px) {
    .app-shell {
        padding-inline: 12px;
    }

    .card,
    .hero-card,
    .brand-card {
        border-radius: 18px;
    }

    .calendar-panel {
        margin-inline: -2px;
        padding: 10px;
        border-radius: 18px;
    }

    .calendar-grid {
        gap: 4px;
    }

    .calendar-day {
        min-height: 58px;
        border-radius: 13px;
        padding: 6px;
    }

    .day-event-count {
        display: none;
    }

    .date-modal-content {
        border-radius: 22px 22px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
