/* ── Reset & Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #faf7f2;
    --card-bg: #ffffff;
    --text: #2c2c2c;
    --text-muted: #888;
    --accent-feed: #66bb6a;
    --accent-wet: #42a5f5;
    --accent-soiled: #8d6e63;
    --accent-sleep: #7e57c2;
    --accent-wake: #ffa726;
    --accent-toggle: #26a69a;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --radius: 14px;
}

body {
    font-family: -apple-system, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 440px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

/* ── Header ── */
.header {
    text-align: center;
    padding: 24px 0 16px;
}

.header__title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header__updated {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ── Summary Cards ── */
.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.summary__card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.summary__emoji {
    font-size: 1.5rem;
}

.summary__value {
    font-size: 1.4rem;
    font-weight: 700;
}

.summary__label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.summary__card--feed .summary__value {
    color: var(--accent-feed);
}

.summary__card--diaper .summary__value {
    color: var(--accent-soiled);
}

.summary__card--sleep .summary__value {
    color: var(--accent-sleep);
}

/* ── Timeline ── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    border-left: 4px solid transparent;
    transition: transform 0.15s ease;
}

.record:active {
    transform: scale(0.98);
}

.record--FEED {
    border-left-color: var(--accent-feed);
}

.record--WET {
    border-left-color: var(--accent-wet);
}

.record--SOILED {
    border-left-color: var(--accent-soiled);
}

.record--BOTH {
    border-left-color: var(--accent-soiled);
}

.record--SLEEP_START {
    border-left-color: var(--accent-sleep);
}

.record--SLEEP_END {
    border-left-color: var(--accent-wake);
}

.record--CUSTOM_TOGGLE {
    border-left-color: var(--accent-toggle);
}

.record__emoji {
    font-size: 1.6rem;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.record__body {
    flex: 1;
    min-width: 0;
}

.record__label {
    font-size: 1rem;
    font-weight: 600;
}

.record__detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.record__time {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
    text-align: right;
}

/* ── Empty State ── */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty__emoji {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty__text {
    font-size: 1rem;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 32px 0 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Loading ── */
.loading {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 100;
    gap: 16px;
    color: var(--text-muted);
}

.loading__spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0d8cf;
    border-top-color: var(--accent-feed);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading--hidden {
    display: none;
}

/* ── Error ── */
.error {
    text-align: center;
    padding: 80px 20px;
}

.error__emoji {
    font-size: 3rem;
    margin-bottom: 12px;
}

.error__text {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.error__retry {
    background: var(--accent-feed);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* ── Date Separator ── */
.date-sep {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 8px 0 4px;
    font-weight: 500;
}