/* =================== 基础重置 =================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #2c2c2c;
    background: #faf7f2;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-image:
        radial-gradient(circle, rgba(214, 59, 59, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input {
    font-family: inherit;
    outline: none;
    border: none;
    background: transparent;
}

/* =================== 广告栏 =================== */
.ad-bar {
    background: #f0f0f0;
    border-bottom: 2px solid #ddd;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    position: sticky;
    top: 0;
    z-index: 500;
}

.ad-link {
    text-decoration: none;
    color: #555;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-link:hover {
    color: #d63b3b;
}

.ad-close {
    width: 22px;
    height: 22px;
    border: 1.5px solid #999;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    color: #999;
    background: #fff;
    cursor: pointer;
    margin-left: 10px;
}

.ad-close:hover {
    background: #ffe5e5;
    color: #d63b3b;
    border-color: #d63b3b;
}

/* =================== 登录/注册浮层 =================== */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 6px 6px 0 #2c2c2c;
    overflow: hidden;
}

.auth-tabs {
    display: flex;
}

/* 试用/停用状态横幅 */
.trial-banner {
    display: flex; align-items: center; justify-content: center;
    padding: 10px 16px; margin: 12px 16px 0;
    border-radius: 10px; font-size: 13px; color: #444;
    border: 1px solid rgba(0,0,0,0.06);
}

.auth-tab {
    flex: 1;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.auth-tab.active {
    background: #fff;
    border-bottom-color: #d63b3b;
    color: #d63b3b;
}

.auth-form {
    padding: 20px;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 600;
}

.auth-form .form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #2c2c2c;
    border-radius: 10px;
    font-size: 15px;
    box-shadow: 2px 2px 0 #2c2c2c;
}

.auth-error {
    padding: 8px 12px;
    background: #ffe5e5;
    color: #d63b3b;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}

.auth-submit {
    width: 100%;
    padding: 12px !important;
    font-size: 16px !important;
}

/* =================== 用户信息栏 =================== */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.user-icon {
    font-size: 16px;
}

#userDisplay {
    font-weight: 600;
    color: #333;
}

.btn-settings, .btn-logout {
    padding: 4px 10px;
    font-size: 12px;
    border: 1.5px solid #2c2c2c;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    box-shadow: 1.5px 1.5px 0 #2c2c2c;
}

.btn-logout {
    color: #d63b3b;
}

.modal-settings {
    max-width: 420px;
}
.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 28px 80px;
}

/* =================== 顶部标题 =================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px dashed #d63b3b;
}

.title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-icon {
    width: 38px;
    height: 38px;
    background: #fff;
    border: 2.5px solid #d63b3b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 0 #d63b3b;
    flex-shrink: 0;
}

.title-icon svg {
    width: 20px;
    height: 20px;
}

.title {
    font-size: 26px;
    font-weight: 700;
    color: #2c2c2c;
    position: relative;
    letter-spacing: 1px;
}

.title::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 6px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 6'><path d='M0 3 Q 12.5 0, 25 3 T 50 3 T 75 3 T 100 3' fill='none' stroke='%23d63b3b' stroke-width='1.8' stroke-linecap='round'/></svg>") repeat-x;
    background-size: 50px 6px;
}

.baby-age {
    font-size: 13px;
    color: #888;
    background: #fff;
    padding: 5px 14px;
    border: 2px solid #2c2c2c;
    border-radius: 999px;
    box-shadow: 2px 2px 0 #2c2c2c;
    font-weight: 600;
    white-space: nowrap;
}

/* =================== 标签导航 =================== */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
}

.tab-btn {
    flex: 1;
    padding: 12px 10px;
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    box-shadow: 3px 3px 0 #2c2c2c;
    transition: all 0.15s;
}

.tab-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #2c2c2c;
}

.tab-btn.active {
    background: #d63b3b;
    color: #fff;
    border-color: #2c2c2c;
    box-shadow: 3px 3px 0 #b91c1c;
}

.tab-emoji {
    font-size: 18px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* =================== 操作栏 =================== */
.action-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-add-top {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #d63b3b;
    color: #fff;
    border: 2px solid #2c2c2c;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 2px 2px 0 #2c2c2c;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-add-top:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #2c2c2c;
}

.btn-add-top:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #2c2c2c;
}

.btn-add-top .plus {
    font-size: 18px;
    line-height: 1;
    margin-top: -2px;
}

.btn-add-now {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: #3b82f6;
    color: #fff;
    border: 2px solid #2c2c2c;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 2px 2px 0 #2c2c2c;
    transition: all 0.15s;
}

.btn-add-now:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #2c2c2c;
}

.btn-add-now:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #2c2c2c;
}

.btn-add-now.orange {
    background: #d97706;
}

/* =================== 统计卡片 =================== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 14px;
    padding: 18px 20px 22px;
    box-shadow: 4px 4px 0 #2c2c2c;
    position: relative;
    transition: transform 0.2s;
    transform: rotate(-0.4deg);
}

.stat-card:nth-child(2) {
    transform: rotate(0.5deg);
}

.stat-card:nth-child(3) {
    transform: rotate(-0.3deg);
}

.stat-card:hover {
    transform: rotate(0deg) translate(-1px, -1px);
    box-shadow: 5px 5px 0 #2c2c2c;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.stat-icon {
    width: 28px;
    height: 28px;
    border: 1.5px solid #2c2c2c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 16px;
    height: 16px;
}

.stat-value {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: #d63b3b;
}

.stat-value-sm .value-num-sm {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    font-family: 'Bradley Hand', 'Comic Sans MS', 'Marker Felt', cursive;
    letter-spacing: -0.5px;
}

.value-num {
    font-size: 38px;
    font-weight: 800;
    line-height: 1;
    font-family: 'Bradley Hand', 'Comic Sans MS', 'Marker Felt', cursive;
    letter-spacing: -0.5px;
}

.value-unit {
    font-size: 16px;
    font-weight: 600;
    color: #d63b3b;
    opacity: 0.8;
}

/* =================== 图表区 =================== */
.chart-section {
    margin-bottom: 40px;
}

.chart-section .title-group {
    margin-bottom: 18px;
}

.chart-card {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 14px;
    padding: 22px 24px 18px;
    box-shadow: 4px 4px 0 #2c2c2c;
    position: relative;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    color: #999;
}

.chart-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-unit {
    font-weight: 600;
    color: #888;
}

.chart-range {
    color: #666;
    font-weight: 500;
}

.chart-stats {
    display: flex;
    gap: 14px;
    font-size: 12px;
}

.chart-stats span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chart-stats .stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d63b3b;
    display: inline-block;
}

.chart-filter {
    display: flex;
    gap: 10px;
    padding: 8px 20px;
    border-bottom: 1px solid #f0e8df;
    background: #faf7f2;
    font-size: 12px;
}
.chart-filter label { display: inline-flex; align-items: center; gap: 6px; color: #888; }
.chart-filter select {
    border: 1px solid #e8e0d5; border-radius: 6px;
    padding: 4px 8px; background: #fff;
    font-size: 12px; color: #444; outline: none;
    cursor: pointer;
}
.chart-filter select:focus { border-color: #d63b3b; }

.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

#weightChart {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #999;
    font-size: 14px;
    pointer-events: none;
}

.empty-illustration svg {
    width: 80px;
    height: 80px;
    opacity: 0.6;
}

/* =================== 时间线 =================== */
.timeline-section {
    margin-bottom: 36px;
}

.timeline-section .title-group {
    margin-bottom: 18px;
}

.timeline-card {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 14px;
    padding: 16px 20px;
    box-shadow: 4px 4px 0 #2c2c2c;
    min-height: 60px;
}

.timeline-list {
    display: flex;
    flex-direction: column;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1.5px dashed #eee;
}

.timeline-item:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.timeline-item:first-child {
    padding-top: 2px;
}

.timeline-time {
    font-size: 15px;
    font-weight: 700;
    color: #2c2c2c;
    min-width: 48px;
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
}

.timeline-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-type-tag {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid #2c2c2c;
}

.timeline-note {
    font-size: 12px;
    color: #888;
    margin-left: auto;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-gap {
    font-size: 11px;
    color: #888;
    margin-left: 4px;
    font-weight: 500;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.timeline-actions {
    display: flex;
    gap: 6px;
}

.timeline-action-btn {
    width: 26px;
    height: 26px;
    border: 1.5px solid #2c2c2c;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 1.5px 1.5px 0 #2c2c2c;
    transition: all 0.12s;
}

.timeline-action-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0 #2c2c2c;
}

.timeline-action-btn svg {
    width: 12px;
    height: 12px;
}

.timeline-empty {
    text-align: center;
    color: #999;
    padding: 24px 0;
    font-size: 14px;
}

/* =================== 历史记录 =================== */
.records-section {
    margin-bottom: 32px;
}

.records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.record-count {
    font-size: 14px;
    color: #888;
    background: #fff;
    padding: 5px 14px;
    border: 2px solid #2c2c2c;
    border-radius: 999px;
    box-shadow: 2px 2px 0 #2c2c2c;
    font-weight: 600;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-item {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 3px 3px 0 #2c2c2c;
    transition: transform 0.2s, box-shadow 0.2s;
}

.record-item:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 #2c2c2c;
}

.record-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    padding: 4px 0;
    border-right: 1.5px dashed #ddd;
    padding-right: 16px;
}

.record-day {
    font-size: 22px;
    font-weight: 800;
    color: #2c2c2c;
    line-height: 1;
}

.record-month {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    font-weight: 500;
}

.record-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.record-weight {
    font-size: 20px;
    font-weight: 700;
    color: #d63b3b;
    display: flex;
    align-items: baseline;
    gap: 3px;
    font-family: 'Bradley Hand', 'Comic Sans MS', 'Marker Felt', cursive;
}

.record-weight .unit {
    font-size: 13px;
    font-weight: 500;
    color: #d63b3b;
    opacity: 0.8;
}

.record-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #888;
    align-items: center;
}

.record-meta .delta-up {
    color: #4caf50;
    font-weight: 600;
}

.record-meta .delta-down {
    color: #ff9800;
    font-weight: 600;
}

.record-meta .delta-flat {
    color: #999;
    font-weight: 600;
}

.record-note {
    font-size: 12px;
    color: #888;
    background: #fff8e1;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-actions {
    display: flex;
    gap: 8px;
}

.record-action-btn {
    width: 32px;
    height: 32px;
    border: 1.8px solid #2c2c2c;
    border-radius: 8px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 1.5px 1.5px 0 #2c2c2c;
}

.record-action-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2.5px 2.5px 0 #2c2c2c;
}

.record-action-btn svg {
    width: 14px;
    height: 14px;
}

.record-action-btn.delete:hover {
    background: #ffe5e5;
}

.record-action-btn.meal-photo {
    padding: 0;
    overflow: hidden;
}

.record-action-btn.meal-photo img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
}

.record-action-btn.meal-photo:hover {
    background: #fff7e6;
}

.empty-records {
    background: #fff;
    border: 2.5px dashed #ccc;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

/* =================== 页脚 =================== */
.footer {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding-top: 20px;
    border-top: 1.5px dashed #ddd;
}

.storage-status {
    margin-top: 6px;
    font-size: 11px;
    color: #aaa;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.storage-status.ok {
    color: #4caf50;
}

.storage-status.error {
    color: #d63b3b;
}

/* =================== 类型选择器 =================== */
.type-selector {
    display: flex;
    gap: 8px;
}

.type-option {
    flex: 1;
    padding: 10px 8px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    transition: all 0.15s;
}

.type-option:hover {
    border-color: #999;
}

.type-option.active {
    border-color: #2c2c2c;
    background: #fff;
    color: #2c2c2c;
    box-shadow: 2px 2px 0 #2c2c2c;
}

.type-option .type-emoji {
    font-size: 16px;
}

/* =================== 弹窗 =================== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal {
    background: #fff;
    border: 2.5px solid #2c2c2c;
    border-radius: 16px;
    width: 100%;
    max-width: 440px;
    box-shadow: 6px 6px 0 #2c2c2c;
    animation: slideUp 0.25s ease-out;
    overflow: hidden;
    /* 内容过多时弹窗不要撑出屏幕：固定最大高度，内部用 flex 让 body 单独滚动 */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
}

.modal-small {
    max-width: 360px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 2px dashed #d63b3b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff8f8;
}

.modal-header h2 {
    font-size: 18px;
    color: #2c2c2c;
    font-weight: 700;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: 2px solid #2c2c2c;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    color: #2c2c2c;
    background: #fff;
    box-shadow: 1.5px 1.5px 0 #2c2c2c;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: #ffe5e5;
    transform: translate(-1px, -1px);
    box-shadow: 2.5px 2.5px 0 #2c2c2c;
}

.modal-body {
    padding: 20px;
    /* 关键三件套，让 body 在内容超出时滚动（不撑爆 header/footer）*/
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-body p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.modal-body p strong {
    color: #d63b3b;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid #2c2c2c;
    border-radius: 10px;
    font-size: 15px;
    color: #2c2c2c;
    background: #fff;
    transition: all 0.15s;
    box-shadow: 2px 2px 0 #2c2c2c;
}

.form-group input:focus {
    border-color: #d63b3b;
    box-shadow: 2px 2px 0 #d63b3b;
}

.weight-input {
    position: relative;
    display: flex;
    align-items: center;
}

.weight-input input {
    padding-right: 36px;
}

.weight-input .input-unit {
    position: absolute;
    right: 14px;
    color: #888;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

.quick-weights {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 6px 14px;
    background: #fff;
    border: 1.5px solid #ddd;
    border-radius: 999px;
    font-size: 13px;
    color: #666;
    transition: all 0.15s;
}

.quick-btn:hover {
    border-color: #d63b3b;
    color: #d63b3b;
    background: #fff5f5;
}

.modal-footer {
    padding: 14px 20px 18px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #fafafa;
    border-top: 1.5px dashed #eee;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.15s;
    border: 2px solid #2c2c2c;
    box-shadow: 2px 2px 0 #2c2c2c;
}

.btn-primary {
    background: #d63b3b;
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #2c2c2c;
}

.btn-danger {
    background: #d63b3b;
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-danger:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 #2c2c2c;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #2c2c2c;
}

/* =================== Toast =================== */
.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #2c2c2c;
    color: #fff;
    padding: 12px 24px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease-out;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #d63b3b;
}

/* =================== 响应式 =================== */
@media (max-width: 720px) {
    .page {
        padding: 20px 16px 60px;
    }

    .title {
        font-size: 20px;
    }

    .header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .tab-nav {
        gap: 6px;
    }

    .tab-btn {
        font-size: 13px;
        padding: 10px 8px;
        gap: 4px;
    }

    .tab-emoji {
        font-size: 16px;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .stat-card {
        transform: none !important;
    }

    .value-num {
        font-size: 32px;
    }

    .stat-value-sm .value-num-sm {
        font-size: 20px;
    }

    .chart-container {
        height: 240px;
    }

    .record-item {
        padding: 12px 14px;
    }

    .record-date-block {
        min-width: 50px;
        padding-right: 12px;
    }

    .record-day {
        font-size: 18px;
    }

    .record-weight {
        font-size: 17px;
    }

    .record-note {
        max-width: 120px;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-add-top,
    .btn-add-now {
        justify-content: center;
    }

    .type-selector {
        flex-wrap: wrap;
    }

    .type-option {
        flex: unset;
        flex: 1 1 auto;
        min-width: 80px;
    }

    .timeline-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .timeline-note {
        margin-left: 0;
        max-width: 100%;
    }
}

/* =================== 校对时间标签 =================== */
.check-early {
    font-size: 11px;
    font-weight: 600;
    color: #4caf50;
    margin-left: 4px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.check-late {
    font-size: 11px;
    font-weight: 600;
    color: #ff9800;
    margin-left: 4px;
    font-family: 'SF Mono', 'Menlo', monospace;
}

.check-on-time {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    margin-left: 4px;
}

.check-first {
    font-size: 11px;
    font-weight: 500;
    color: #aaa;
    margin-left: 4px;
}

/* =================== 闹钟开关 =================== */
.alarm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    cursor: pointer;
}

.alarm-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    border: 2px solid #2c2c2c;
    box-shadow: 2px 2px 0 #2c2c2c;
    transition: background 0.2s;
    flex-shrink: 0;
}

.alarm-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: 1.5px solid #2c2c2c;
    transition: transform 0.2s;
}

.alarm-switch.on {
    background: #4caf50;
}

.alarm-switch.on::after {
    transform: translateX(20px);
}

.alarm-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.alarm-label.on {
    color: #4caf50;
    font-weight: 600;
}

.alarm-label.overdue {
    color: #d63b3b;
    font-weight: 700;
    animation: pulse-overdue 1s ease-in-out infinite alternate;
}

@keyframes pulse-overdue {
    from { opacity: 1; }
    to { opacity: 0.4; }
}

/* =================== 历史记录按月折叠 =================== */
.month-group {
    margin-bottom: 12px;
}

.month-header {
    padding: 10px 16px;
    background: #2c2c2c;
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    box-shadow: 3px 3px 0 #ccc;
}

.month-header::after {
    content: '▾';
    font-size: 16px;
    transition: transform 0.2s;
}

.month-header.collapsed::after {
    transform: rotate(-90deg);
}

.month-block {
    margin-top: 6px;
    padding: 0 4px;
}

.month-block.collapsed {
    display: none;
}

/* =================== OCR 拍照识别 =================== */
.btn-add-camera {
    flex: 1;
    padding: 12px 16px;
    background: #fff;
    border: 2px dashed #2c2c2c;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #2c2c2c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 2px 2px 0 #ccc;
    transition: all 0.15s;
}

.btn-add-camera:hover {
    background: #f5f0e8;
    box-shadow: 3px 3px 0 #999;
}

.btn-add-camera:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #999;
}

.ocr-preview {
    margin: 12px 0;
    border: 2px dashed #ddd;
    border-radius: 12px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fafafa;
}

.ocr-preview img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

.ocr-buttons,
.ocr-confirm-btns {
    display: flex;
    justify-content: stretch;
}

#ocrResult {
    font-size: 16px;
    font-weight: 600;
    border: 1px solid #ddd;
}

#ocrResult.success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

#ocrResult.error {
    background: #ffebee;
    border-color: #d63b3b;
    color: #c62828;
}

/* ==================== 忘记密码：企业微信引导 ==================== */
.forgot-pwd-tip {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: #8a8a8a;
}
.forgot-pwd-link {
    color: #fa8c16;
    text-decoration: none;
}
.forgot-pwd-link:hover {
    text-decoration: underline;
}

.modal-wecom {
    max-width: 380px;
    text-align: center;
}
.modal-wecom .modal-body p {
    text-align: left;
}
.wecom-id {
    margin: 16px 0 14px;
    padding: 12px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #2c2c2c;
    background: #fff7e6;
    border: 2px dashed #fa8c16;
    border-radius: 10px;
    user-select: all;
}
.wecom-copy {
    width: 100%;
}
