/* 苗条计划 · 减重管理 - 双主题（深色默认 + 浅色白粉） */
:root, [data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-input: #21262d;
    --border: #30363d;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #f59e0b;      /* 暖金：活力 */
    --accent2: #58a6ff;     /* 蓝：清爽 */
    --green: #22c55e;       /* 成功/达标 */
    --red: #ef4444;         /* 警示 */
    --pink: #ec4899;        /* 备孕主题色 */
    --header-grad: linear-gradient(135deg, #1a1f2e 0%, #161b22 100%);
    --tab-grad: linear-gradient(0deg, #0d1117 0%, #161b22 100%);
    --shadow: none;
    --tab-height: 58px;
}

/* 浅色主题：白底 + 粉色主调 */
[data-theme="light"] {
    --bg: #fff5f8;
    --bg-card: #ffffff;
    --bg-input: #fdf0f4;
    --border: #f2d7e0;
    --text: #2d1b24;
    --text-secondary: #6b4a58;
    --text-muted: #a0788a;
    --accent: #d97706;
    --accent2: #3b82f6;
    --green: #16a34a;
    --red: #dc2626;
    --pink: #ec4899;
    --header-grad: linear-gradient(135deg, #fff 0%, #ffeef5 100%);
    --tab-grad: linear-gradient(0deg, #fff 0%, #ffeef5 100%);
    --shadow: 0 2px 8px rgba(236,72,153,0.08);
}

/* 主题切换过渡 */
body, .top-bar, .tab-bar, .card, .input, .stat-card, .progress-wrap, .rec-block, .cal-day {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
}

.app { display: flex; flex-direction: column; height: 100vh; max-width: 480px; margin: 0 auto; }

/* 顶栏 */
.top-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px 10px;
    background: var(--header-grad);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.logo { font-size: 16px; font-weight: 700; color: var(--pink); letter-spacing: 1px; }
.clock { font-size: 12px; color: var(--text-muted); font-family: monospace; }

/* 主内容区 */
.main-content {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    padding-bottom: calc(var(--tab-height) + 16px);
}

/* 底部导航 */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--tab-height);
    background: var(--tab-grad);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
    max-width: 480px; margin: 0 auto;
}
.tab-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; padding: 6px 10px; cursor: pointer;
    font-size: 10px; color: var(--text-muted);
    transition: all 0.2s; border-radius: 8px;
}
.tab-item span { font-size: 10px; }
.tab-item.active { color: var(--pink); }
.tab-item.active span { font-weight: 700; }

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
}
.card-title {
    font-size: 14px; font-weight: 700;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.card-title .tag {
    font-size: 10px; font-weight: 400;
    padding: 1px 8px; border-radius: 10px;
    color: var(--green); background: rgba(34,197,94,0.12);
}
.card-title .tag.warn { color: var(--accent); background: rgba(245,158,11,0.12); }

/* 按钮 */
.btn {
    display: block; width: 100%;
    padding: 13px; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600;
    background: linear-gradient(135deg, var(--pink), #d946ef);
    color: #fff; cursor: pointer;
    transition: opacity 0.2s;
}
.btn:active { opacity: 0.8; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 400;
}
.btn-sm { padding: 8px 14px; font-size: 12px; width: auto; display: inline-block; }

/* 输入 */
.input {
    width: 100%; padding: 11px 12px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 14px;
    outline: none;
}
.input:focus { border-color: var(--pink); }
select.input { appearance: none; }
.input-group { display: flex; gap: 8px; margin-bottom: 10px; }
.input-group .input { flex: 1; }

/* 数字大卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card {
    background: var(--bg-input); border-radius: 10px;
    padding: 10px 6px; text-align: center;
}
.stat-card .num { font-size: 20px; font-weight: 700; }
.stat-card .label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* 列表 */
.list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.list-item:last-child { border-bottom: none; }

/* 进度条 */
.progress-wrap { background: var(--bg-input); border-radius: 8px; height: 10px; overflow: hidden; }
.progress-fill {
    height: 100%; border-radius: 8px;
    background: linear-gradient(90deg, var(--pink), var(--accent));
    transition: width 0.6s ease;
}

/* 用餐状态标签 */
.meal-status {
    display: inline-block; font-size: 11px; padding: 2px 10px;
    border-radius: 12px; margin: 2px 4px 2px 0;
}
.meal-done { background: rgba(34,197,94,0.15); color: var(--green); }
.meal-pending { background: rgba(245,158,11,0.15); color: var(--accent); }
.meal-miss { background: rgba(239,68,68,0.15); color: var(--red); }

/* 环形容器 */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring-info { flex: 1; }

/* Toast */
.toast {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    background: rgba(13,17,23,0.95); color: var(--text);
    padding: 10px 18px; border-radius: 20px; font-size: 13px;
    border: 1px solid var(--border); z-index: 999;
    max-width: 90%; text-align: center;
}
.toast.hidden { display: none; }

/* 日历网格 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day {
    aspect-ratio: 1; border-radius: 8px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 11px; background: var(--bg-input);
    color: var(--text-secondary); position: relative;
}
.cal-day.done { background: rgba(34,197,94,0.18); color: var(--green); }
.cal-day.today { border: 1px solid var(--pink); }
.cal-day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); margin-top: 2px; }

/* 表格 */
table.week-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.week-table th, .week-table td {
    padding: 6px 4px; border-bottom: 1px solid var(--border);
    text-align: center; color: var(--text-secondary);
}
.week-table th { color: var(--text-muted); font-weight: 400; }

/* 饮食推荐块 */
.rec-block {
    background: var(--bg-input); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 8px; font-size: 12px;
    line-height: 1.8;
}
.rec-block .rec-title { font-weight: 700; color: var(--accent); margin-bottom: 4px; }

/* 食物行 */
.food-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.food-row .cal { color: var(--text-muted); font-size: 12px; }
.food-row .del { color: var(--red); font-size: 16px; padding: 0 6px; cursor: pointer; }

.empty-state { text-align: center; padding: 24px 10px; color: var(--text-muted); font-size: 13px; }
.empty-state .icon { font-size: 32px; margin-bottom: 8px; }

.highlight { color: var(--pink); font-weight: 700; }
.warn-text { color: var(--accent); font-size: 12px; }
.danger-text { color: var(--red); font-size: 12px; }
.muted { color: var(--text-muted); font-size: 12px; }
.small { font-size: 11px; }
