/* ============================================================
   健康管理网站 - 样式表
   苹果高级 App 风格：大圆角卡片 / 毛玻璃 / 柔和阴影 / 底部Tab栏
   ============================================================ */
   * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

   :root {
     --bg: #f2f3f7;
     --card: #ffffff;
     --text: #1c1c1e;
     --text2: #6e6e73;
     --text3: #aeaeb2;
     --blue: #0a84ff;
     --blue-dark: #0071e3;
     --green: #34c759;
     --red: #ff3b30;
     --orange: #ff9500;
     --purple: #af52de;
     --border: rgba(0, 0, 0, 0.06);
     --shadow: 0 8px 28px rgba(0, 0, 0, 0.07);
     --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.12);
   }
   
   html, body { height: 100%; }
   
   body {
     font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
       "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
     background: radial-gradient(1200px 600px at 50% -10%, #1b2432 0%, #0b0d12 60%);
     color: var(--text);
     -webkit-font-smoothing: antialiased;
     overflow-x: hidden;
   }
   
   .hidden { display: none !important; }
   
   /* ============ 手机壳（PC 居中显示） ============ */
   .phone-shell {
     width: 100%;
     max-width: 420px;
     margin: 0 auto;
     min-height: 100vh;
     min-height: 100dvh;
     background: var(--bg);
     position: relative;
     overflow: hidden;
   }
   
   @media (min-width: 480px) {
     body { padding: 26px 0; }
     .phone-shell {
       min-height: calc(100dvh - 52px);
       border-radius: 42px;
       box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
     }
   }
   
   /* ============ 通用页面 ============ */
   .page { width: 100%; }
   .app-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
   
   /* ============ 卡片 ============ */
   .card {
     background: var(--card);
     border-radius: 22px;
     box-shadow: var(--shadow);
     padding: 18px;
     margin: 12px 14px;
     animation: cardIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
   }
   
   @keyframes cardIn {
     from { opacity: 0; transform: translateY(10px); }
     to { opacity: 1; transform: translateY(0); }
   }
   
   .gradient-card {
     background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%);
     color: #fff;
     box-shadow: 0 12px 30px rgba(10, 132, 255, 0.35);
   }
   
   .glass {
     background: rgba(255, 255, 255, 0.82);
     backdrop-filter: blur(22px) saturate(180%);
     -webkit-backdrop-filter: blur(22px) saturate(180%);
   }
   
   /* ============ 头部 ============ */
   .app-header {
     position: sticky;
     top: 0;
     z-index: 20;
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 16px 20px 12px;
     padding-top: calc(16px + env(safe-area-inset-top, 0px));
     border-bottom: 1px solid var(--border);
   }
   .app-header h2 {
     font-size: 26px;
     font-weight: 800;
     letter-spacing: -0.5px;
   }
   .user-badge {
     background: rgba(10, 132, 255, 0.12);
     color: var(--blue);
     font-size: 13px;
     font-weight: 600;
     padding: 6px 13px;
     border-radius: 999px;
     max-width: 120px;
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
   }
   
   /* ============ 内容区 ============ */
   .app-content {
     flex: 1;
     padding: 8px 0 calc(110px + env(safe-area-inset-bottom, 0px));
   }
   
   /* ============ 概览卡片 ============ */
   .overview-card {
     display: flex;
     padding: 22px 10px;
     margin-top: 14px;
   }
   .ov-item {
     flex: 1;
     text-align: center;
     position: relative;
   }
   .ov-item + .ov-item::before {
     content: "";
     position: absolute;
     left: 0;
     top: 14%;
     bottom: 14%;
     width: 1px;
     background: rgba(255, 255, 255, 0.25);
   }
   .ov-label {
     display: block;
     font-size: 12px;
     opacity: 0.85;
     letter-spacing: 0.3px;
   }
   .ov-value {
     display: block;
     font-size: 34px;
     font-weight: 800;
     margin-top: 6px;
     letter-spacing: -1px;
     font-variant-numeric: tabular-nums;
   }
   
   /* ============ 卡片标题行 ============ */
   .card-title-row {
     display: flex;
     align-items: center;
     justify-content: space-between;
     margin-bottom: 12px;
   }
   .card-title-row h3 {
     font-size: 17px;
     font-weight: 700;
     letter-spacing: -0.3px;
   }
   .card-desc {
     font-size: 12.5px;
     color: var(--text2);
     line-height: 1.6;
     margin-bottom: 12px;
   }
   .cal-card-foot {
     display: flex;
     justify-content: flex-end;
     margin-top: 2px;
   }
   .cal-num {
     font-size: 14px;
     font-weight: 700;
     color: var(--blue);
     font-variant-numeric: tabular-nums;
   }
   
   /* ============ 进度条 ============ */
   .progress-track {
     height: 10px;
     background: rgba(0, 0, 0, 0.07);
     border-radius: 999px;
     overflow: hidden;
     position: relative;
   }
   .recommend-line {
     position: absolute;
     top: 0;
     bottom: 0;
     width: 2px;
     z-index: 5;
     pointer-events: none;
     transform: translateX(-50%); /* left百分比居中对齐，关键！ */
     /* SVG原生虚线，代替border‑left dashed */
     background-image: url('data:image/svg+xml;utf8,<svg width="2" height="22" xmlns="http://www.w3.org/2000/svg"><line x1="1" y1="0" x2="1" y2="22" stroke="%238e8e93" stroke-opacity="0.75" stroke-width="2" stroke-dasharray="2 2"/></svg>');
     background-repeat: repeat-y;
     background-position: center;
   }
   
   .progress-fill {
     height: 100%;
     border-radius: 999px;
     background: linear-gradient(90deg, #0a84ff, #5e5ce6);
     transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
   }
   .progress-fill.green { background: linear-gradient(90deg, #34c759, #30d158); }
   .progress-fill.over { background: linear-gradient(90deg, #ff9500, #ff3b30); }
   .progress-fill.danger { background: linear-gradient(90deg, #ff3b30, #ff6961); }
   
   .cal-line-info {
     display: flex;
     justify-content: space-between;
     flex-wrap: wrap;
     gap: 4px;
     margin-top: 8px;
     font-size: 12px;
     color: var(--text2);
   }
   .cal-line-info b { color: var(--text); font-variant-numeric: tabular-nums; }
   
   .cal-warning {
     margin-top: 10px;
     padding: 9px 12px;
     border-radius: 12px;
     background: rgba(255, 59, 48, 0.12);
     color: #ff3b30;
     font-size: 13px;
     font-weight: 700;
     text-align: center;
   }
   .cal-warning.hidden { display: none; }
   /* 摄入预警分级配色：白(差很多)/红(默认,31-70%)/黄(71-75%)/绿(76-80%) */
   .cal-warning.cal-w {
     background: #ffffff;
     color: #1c1c1e;
     box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
   }
   .cal-warning.cal-y {
     background: rgba(255, 193, 7, 0.16);
     color: #b45309;
   }
   .cal-warning.cal-g {
     background: rgba(52, 199, 89, 0.14);
     color: #1e9e50;
   }
   
   .diff-hint {
     display: block;
     margin-top: 6px;
     font-size: 11.5px;
     color: var(--text3);
   }
   
   .mini-summary {
     display: flex;
     justify-content: space-between;
     margin-top: 12px;
     font-size: 12.5px;
     color: var(--text2);
   }
   .mini-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
   
   /* ============ 热量汇总 ============ */
   .sum-bar {
     display: flex;
     align-items: center;
     gap: 14px;
     margin-bottom: 16px;
   }
   .sum-side {
     display: flex;
     flex-direction: column;
     align-items: center;
     min-width: 82px;
   }
   .sum-side-label {
     font-size: 12px;
     font-weight: 600;
     color: var(--text2);
   }
   .sum-side-value {
     font-size: 28px;
     font-weight: 800;
     letter-spacing: -0.6px;
     font-variant-numeric: tabular-nums;
     margin-top: 3px;
     color: var(--text);
   }
   .sum-side-value.neg { color: var(--red); }
   .sum-side-unit { font-size: 11px; color: var(--text3); margin-top: 1px; }
   .sum-track-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; }
   .sum-track-wrap .progress-track { height: 12px; }
   .sum-percent {
     font-size: 12px;
     font-weight: 600;
     color: var(--text2);
     text-align: center;
     font-variant-numeric: tabular-nums;
   }
   .sum-stats { display: flex; gap: 12px; }
   .sum-stat {
     flex: 1;
     background: #f5f5f7;
     border-radius: 16px;
     padding: 14px 10px;
     display: flex;
     flex-direction: column;
     align-items: center;
   }
   .sum-stat-label { font-size: 12px; font-weight: 600; color: var(--text2); }
   .sum-stat-value {
     font-size: 26px;
     font-weight: 800;
     letter-spacing: -0.5px;
     font-variant-numeric: tabular-nums;
     margin-top: 4px;
     color: var(--text);
   }
   .sum-stat-value.neg { color: var(--red); }
   .sum-stat-unit { font-size: 11px; color: var(--text3); margin-top: 2px; }

   /* ============ 热量汇总 · 区间选择弹窗 ============ */
   .picker-dim-tip {
     font-size: 12.5px;
     color: var(--text2);
     margin-bottom: 12px;
     line-height: 1.5;
   }
   .picker-cal-head {
     display: flex;
     align-items: center;
     justify-content: space-between;
     margin-bottom: 10px;
   }
   .picker-cal-title { font-size: 14px; font-weight: 700; }
   .picker-cal {
     background: #f5f5f7;
     border-radius: 16px;
     padding: 14px 12px;
     margin-bottom: 12px;
     user-select: none;
   }
   .picker-cal .cal-week { margin-bottom: 6px; }
   .picker-cal .cal-cell.selected em {
     background: var(--blue);
     color: #fff;
     width: 26px;
     height: 26px;
     display: flex;
     align-items: center;
     justify-content: center;
     border-radius: 50%;
     font-weight: 700;
   }
   .picker-week-info {
     font-size: 12.5px;
     color: var(--text2);
     text-align: center;
     margin-top: 10px;
     font-weight: 600;
     font-variant-numeric: tabular-nums;
   }
   .picker-selects { display: flex; gap: 10px; margin-bottom: 4px; }
   .picker-selects .field { flex: 1; margin-bottom: 0; }

   .progress-label {
     display: flex;
     justify-content: space-between;
     margin-top: 8px;
     font-size: 12.5px;
     color: var(--text2);
   }
   .progress-label span:first-child {
     color: var(--green);
     font-weight: 700;
     font-size: 14px;
   }
   
   /* ============ 饮食分组 ============ */
   .meal-group { margin-bottom: 10px; }
   .meal-group:last-child { margin-bottom: 0; }
   .meal-head {
     display: flex;
     align-items: center;
     justify-content: space-between;
     margin-bottom: 6px;
   }
   .meal-badge {
     font-size: 12px;
     font-weight: 700;
     color: #fff;
     padding: 3px 10px;
     border-radius: 999px;
   }
   .meal-badge.breakfast { background: #ff9500; }
   .meal-badge.lunch { background: #0a84ff; }
   .meal-badge.dinner { background: #5e5ce6; }
   .meal-badge.snack { background: #34c759; }
   .meal-badge.small { padding: 2px 8px; font-size: 11px; }
   .meal-cal { font-size: 12px; color: var(--text2); font-weight: 600; }
   
   /* ============ 行项目 ============ */
   .row-item {
     display: flex;
     align-items: center;
     gap: 10px;
     padding: 9px 12px;
     background: #f5f5f7;
     border-radius: 14px;
     margin-bottom: 6px;
     animation: rowIn 0.25s ease;
   }
   @keyframes rowIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
   .ri-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
   .ri-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
   .ri-sub { font-size: 11.5px; color: var(--text2); margin-top: 1px; }
   .ri-cal { font-size: 13px; color: var(--text2); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
   .ri-del {
     width: 26px; height: 26px;
     border: none;
     border-radius: 50%;
     background: rgba(255, 59, 48, 0.1);
     color: var(--red);
     font-size: 16px;
     line-height: 1;
     cursor: pointer;
     flex-shrink: 0;
     transition: transform 0.15s ease, background 0.15s ease;
   }
   .ri-del:hover { background: rgba(255, 59, 48, 0.2); }
   .ri-del:active { transform: scale(0.88); }
   
   .empty-tip {
     text-align: center;
     color: var(--text3);
     font-size: 13px;
     padding: 10px 0;
   }
   
   /* ============ 按钮 ============ */
   .btn-primary {
     border: none;
     background: var(--blue);
     color: #fff;
     font-size: 16px;
     font-weight: 700;
     padding: 13px 18px;
     border-radius: 14px;
     cursor: pointer;
     transition: transform 0.12s ease, opacity 0.2s ease, background 0.2s ease;
     font-family: inherit;
   }
   .btn-primary:hover { background: var(--blue-dark); }
   .btn-primary:active { transform: scale(0.97); }
   .btn-primary:disabled { opacity: 0.5; }
   .btn-block { display: block; width: 100%; }
   
   .btn-secondary {
     border: none;
     background: #f0f0f2;
     color: var(--text);
     font-size: 15px;
     font-weight: 600;
     padding: 12px 18px;
     border-radius: 14px;
     cursor: pointer;
     font-family: inherit;
   }
   
   .btn-danger {
     border: none;
     background: rgba(255, 59, 48, 0.1);
     color: var(--red);
     font-size: 16px;
     font-weight: 700;
     padding: 13px 18px;
     border-radius: 14px;
     cursor: pointer;
     margin: 12px 14px 20px;
     width: calc(100% - 28px);
     font-family: inherit;
     transition: background 0.2s ease, transform 0.12s ease;
   }
   .btn-danger:hover { background: rgba(255, 59, 48, 0.16); }
   .btn-danger:active { transform: scale(0.98); }
   
   .btn-mini {
     border: none;
     background: rgba(10, 132, 255, 0.12);
     color: var(--blue);
     font-size: 13px;
     font-weight: 600;
     padding: 7px 14px;
     border-radius: 999px;
     cursor: pointer;
     font-family: inherit;
     transition: background 0.2s ease;
   }
   .btn-mini:hover { background: rgba(10, 132, 255, 0.2); }
   
   /* ============ 说明按钮 ⓘ ============ */
   .btn-info {
     width: 26px;
     height: 26px;
     border: none;
     border-radius: 50%;
     background: rgba(10, 132, 255, 0.12);
     color: var(--blue);
     font-size: 15px;
     font-weight: 700;
     line-height: 1;
     display: inline-flex;
     align-items: center;
     justify-content: center;
     cursor: pointer;
     font-family: inherit;
     transition: background 0.2s ease, transform 0.2s ease;
   }
   .btn-info:hover { background: rgba(10, 132, 255, 0.22); }
   .btn-info:active { transform: scale(0.92); }
   
   /* ============ 表单 ============ */
   .field { margin-bottom: 12px; }
   .field label {
     display: block;
     font-size: 12.5px;
     font-weight: 600;
     color: var(--text2);
     margin-bottom: 6px;
   }
   .field input,
   .field select,
   #trendRange {
     width: 100%;
     border: 1px solid var(--border);
     background: #f7f7f9;
     border-radius: 14px;
     padding: 12px 14px;
     font-size: 15px;
     color: var(--text);
     outline: none;
     font-family: inherit;
     transition: border-color 0.2s ease, background 0.2s ease;
     -webkit-appearance: none;
     appearance: none;
   }
   .field input:focus,
   .field select:focus {
     border-color: var(--blue);
     background: #fff;
   }
   .field select {
     background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238e8e93' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
     background-repeat: no-repeat;
     background-position: right 14px center;
     padding-right: 34px;
   }
   .field-row { display: flex; gap: 10px; }
   .field-row .field { flex: 1; }
   .calc-btn-col { display: flex; align-items: flex-end; }
   
   textarea#jsonText {
     width: 100%;
     min-height: 150px;
     border: 1px solid var(--border);
     background: #f7f7f9;
     border-radius: 14px;
     padding: 12px 14px;
     font-size: 13px;
     font-family: "SF Mono", "Menlo", "Consolas", monospace;
     color: var(--text);
     outline: none;
     resize: vertical;
     margin-bottom: 12px;
     line-height: 1.6;
     transition: border-color 0.2s ease;
   }
   textarea#jsonText:focus { border-color: var(--blue); background: #fff; }
   
   /* ============ Segmented 控件 ============ */
   .segmented {
     display: flex;
     background: rgba(0, 0, 0, 0.06);
     border-radius: 12px;
     padding: 3px;
     margin-bottom: 16px;
   }
   .seg-btn {
     flex: 1;
     border: none;
     background: transparent;
     font-size: 14px;
     font-weight: 600;
     color: var(--text2);
     padding: 8px 0;
     border-radius: 10px;
     cursor: pointer;
     font-family: inherit;
     transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
   }
   .seg-btn.active {
     background: #fff;
     color: var(--text);
     box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
   }
   .segmented.small .seg-btn { padding: 7px 0; font-size: 13px; margin-bottom: 0; }
   
   /* ============ 搜索食物弹窗 ============ */
   .search-row {
     display: flex;
     gap: 8px;
     margin-bottom: 14px;
   }
   .search-input {
     flex: 1;
     min-width: 0;
     border: 1px solid var(--border);
     background: #f7f7f9;
     border-radius: 14px;
     padding: 10px 14px;
     font-size: 15px;
     color: var(--text);
     outline: none;
     font-family: inherit;
     transition: border-color 0.2s ease, background 0.2s ease;
     -webkit-appearance: none;
     appearance: none;
   }
   .search-input:focus {
     border-color: var(--blue);
     background: #fff;
   }
   .search-go {
     flex-shrink: 0;
     padding: 10px 18px;
     font-size: 14px;
   }
   .ta-tag {
     display: inline-block;
     align-self: flex-start;
     background: #0a84ff;
     color: #fff;
     font-size: 10.5px;
     font-weight: 700;
     line-height: 1.4;
     padding: 2px 8px;
     border-radius: 999px;
     margin-bottom: 3px;
   }
   .ri-main .ri-name + .ri-sub { margin-top: 2px; }
   
   /* ============ 登录页 ============ */
   .login-page { min-height: 100vh; min-height: 100dvh; padding: 60px 0 40px; }
   .login-hero { text-align: center; padding: 20px 24px 28px; }
   .login-logo { margin-bottom: 16px; filter: drop-shadow(0 10px 20px rgba(10, 132, 255, 0.3)); }
   .login-hero h1 {
     font-size: 30px;
     font-weight: 800;
     letter-spacing: -0.8px;
   }
   .login-hero p {
     color: var(--text2);
     font-size: 14px;
     margin-top: 6px;
   }
   .login-card { padding: 20px; }
   
   /* ============ 日历 ============ */
   .cal-nav {
     display: flex;
     align-items: center;
     gap: 8px;
   }
   .cal-nav span {
     font-size: 15px;
     font-weight: 700;
     min-width: 88px;
     text-align: center;
   }
   .cal-arrow { padding: 6px 13px; font-size: 16px; line-height: 1; }
   
   .cal-grid { user-select: none; }
   .cal-week {
     display: grid;
     grid-template-columns: repeat(7, 1fr);
     margin-bottom: 6px;
   }
   .cal-week span {
     text-align: center;
     font-size: 11px;
     color: var(--text3);
     font-weight: 600;
     padding: 6px 0;
   }
   .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
   .cal-cell {
     position: relative;
     aspect-ratio: 1;
     display: flex;
     align-items: center;
     justify-content: center;
     border-radius: 12px;
     cursor: pointer;
     transition: background 0.15s ease, transform 0.1s ease;
   }
   .cal-cell em { font-style: normal; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
   .cal-cell:hover { background: rgba(10, 132, 255, 0.08); }
   .cal-cell:active { transform: scale(0.9); }
   .cal-cell.empty { cursor: default; }
   .cal-cell.empty:hover { background: transparent; }
   .cal-cell.today em {
     width: 26px; height: 26px;
     display: flex; align-items: center; justify-content: center;
     background: rgba(10, 132, 255, 0.14);
     color: var(--blue);
     border-radius: 50%;
     font-weight: 700;
   }
   .cal-cell.has em { font-weight: 700; color: var(--text); }
   .cal-cell .dot {
     position: absolute;
     bottom: 5px;
     width: 6px; height: 6px;
     border-radius: 50%;
     background: var(--green);
     box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.2);
   }
   
   /* ============ 目标卡片 ============ */
   .goal-nums { display: flex; margin-bottom: 14px; }
   .goal-nums > div { flex: 1; text-align: center; }
   .g-label { display: block; font-size: 12px; color: var(--text2); }
   .g-value {
     display: block;
     font-size: 24px;
     font-weight: 800;
     margin-top: 4px;
     letter-spacing: -0.5px;
     font-variant-numeric: tabular-nums;
   }
   
   /* ============ 图表 ============ */
   .chart { width: 100%; height: 260px; }
   
   /* ============ 我的页 ============ */
   .profile-view { display: flex; flex-direction: column; gap: 4px; }
   .pv-row {
     display: flex;
     justify-content: space-between;
     padding: 9px 12px;
     background: #f5f5f7;
     border-radius: 12px;
     font-size: 14px;
   }
   .pv-k { color: var(--text2); }
   .pv-v { font-weight: 600; }
   
   .hr-grid {
     display: grid;
     grid-template-columns: repeat(4, 1fr);
     gap: 8px;
     margin: 10px 0;
   }
   .hr-cell {
     background: #f5f5f7;
     border-radius: 14px;
     padding: 12px 6px;
     text-align: center;
   }
   .hr-k { display: block; font-size: 11px; color: var(--text2); margin-bottom: 4px; }
   .hr-v { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
   .hr-advice {
     font-size: 13px;
     color: var(--text2);
     line-height: 1.7;
     background: rgba(52, 199, 89, 0.08);
     border-radius: 14px;
     padding: 12px;
   }
   
   .tip-list {
     list-style: none;
     display: flex;
     flex-direction: column;
     gap: 8px;
   }
   .tip-list li {
     position: relative;
     padding: 10px 12px 10px 30px;
     background: #f5f5f7;
     border-radius: 12px;
     font-size: 13.5px;
     line-height: 1.6;
   }
   .tip-list li::before {
     content: "";
     position: absolute;
     left: 13px;
     top: 17px;
     width: 6px; height: 6px;
     border-radius: 50%;
     background: var(--blue);
   }
   
   /* ============ 导入结果 ============ */
   #importResult { margin-top: 12px; }
   .import-ok {
     background: rgba(52, 199, 89, 0.1);
     color: #1d7f38;
     font-weight: 700;
     font-size: 14px;
     padding: 12px;
     border-radius: 14px;
   }
   .import-errors {
     background: rgba(255, 59, 48, 0.08);
     color: #c12b22;
     font-size: 13px;
     line-height: 1.8;
     padding: 12px;
     border-radius: 14px;
     margin-top: 8px;
   }
   
   /* ============ 底部 Tab 栏 ============ */
   .tab-bar {
     position: fixed;
     bottom: 0;
     left: 50%;
     transform: translateX(-50%);
     width: 100%;
     max-width: 420px;
     display: flex;
     padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
     border-top: 1px solid var(--border);
     z-index: 30;
   }
   .tab-btn {
     flex: 1;
     display: flex;
     flex-direction: column;
     align-items: center;
     gap: 2px;
     border: none;
     background: transparent;
     color: var(--text3);
     font-size: 11px;
     font-weight: 600;
     padding: 5px 0;
     cursor: pointer;
     font-family: inherit;
     transition: color 0.2s ease;
     position: relative;
   }
   .tab-btn svg { transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
   .tab-btn.active { color: var(--blue); }
   .tab-btn.active svg { transform: translateY(-1px) scale(1.06); }
   
   /* ============ 弹窗 ============ */
   .modal-overlay {
     position: fixed;
     inset: 0;
     background: rgba(0, 0, 0, 0.42);
     backdrop-filter: blur(4px);
     -webkit-backdrop-filter: blur(4px);
     display: flex;
     align-items: flex-end;
     justify-content: center;
     z-index: 100;
     animation: fadeIn 0.25s ease;
   }
   @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
   
   .modal {
     width: 100%;
     max-width: 420px;
     border-radius: 24px 24px 0 0;
     margin: 0;
     padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
     max-height: 82vh;
     max-height: 82dvh;
     overflow-y: auto;
     animation: sheetUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
   }
   @keyframes sheetUp {
     from { transform: translateY(40px); opacity: 0.5; }
     to { transform: translateY(0); opacity: 1; }
   }
   .modal-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; letter-spacing: -0.3px; }
   .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
   .modal-head .modal-title { margin-bottom: 0; }
   .modal-head-btns { display: flex; gap: 8px; flex-shrink: 0; }
   .modal-head-btns .btn-mini { white-space: nowrap; }
   .btn-danger-mini { background: rgba(255, 59, 48, 0.12) !important; color: var(--red) !important; }
   .btn-danger-mini:hover { background: rgba(255, 59, 48, 0.2) !important; }
   .modal-actions { display: flex; gap: 10px; margin-top: 16px; }
   .modal-actions .btn-primary, .modal-actions .btn-secondary { flex: 1; }
   
   /* 键盘适配：APK(WebView) 软键盘弹出时，弹窗收缩到视觉视口内，内容区可滚动露出底部按钮 */
   .modal-overlay.kb-open .modal {
     max-height: calc(var(--kb-h, 100vh) - 16px);
     transition: max-height 0.15s ease;
   }
   .detail-block { margin-bottom: 14px; }
   .detail-block h4 { font-size: 14px; font-weight: 800; margin-bottom: 6px; color: var(--text); }
   .detail-block p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--text2); }
   .macro-info-title.modal-title { text-align: center; font-size: 20px; font-weight: 800; margin-bottom: 18px; }
   .detail-block .row-item { background: #f5f5f7; }
   
   /* ============ 选择复制圆环 ============ */
   .sel-ring {
     width: 18px;
     height: 18px;
     border-radius: 50%;
     border: 2px solid #c7c7cc;
     flex-shrink: 0;
     box-sizing: border-box;
     transition: background 0.2s ease, border-color 0.2s ease;
   }
   .sel-ring.on {
     border-color: #34c759;
     background: #34c759;
     box-shadow: inset 0 0 0 3px #fff;
   }
   .row-item.sel-on { background: #eafaf0; }
   
   /* ============ Toast ============ */
   .toast {
     position: fixed;
     top: 60px;
     left: 50%;
     transform: translateX(-50%) translateY(-20px);
     background: rgba(28, 28, 30, 0.92);
     color: #fff;
     font-size: 14px;
     font-weight: 600;
     padding: 11px 20px;
     border-radius: 999px;
     box-shadow: var(--shadow-lg);
     z-index: 200;
     opacity: 0;
     pointer-events: none;
     transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
     max-width: 88%;
     text-align: center;
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
   }
   .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
   .toast.error { background: rgba(255, 59, 48, 0.94); }
   
   /* ============ 滚动条美化 ============ */
   ::-webkit-scrollbar { width: 5px; height: 5px; }
   ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); border-radius: 99px; }
   ::-webkit-scrollbar-track { background: transparent; }
   
   /* ============ 宏量营养素 ============ */
   .progress-track.small { height: 6px; }
   .macro-row { margin-bottom: 12px; }
   .macro-row:last-of-type { margin-bottom: 4px; }
   .macro-head {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 6px;
     font-size: 13px;
   }
   .macro-name { color: var(--text); font-weight: 600; }
   .macro-num { color: var(--text2); font-variant-numeric: tabular-nums; }
   .macro-num.over-num { color: #ff3b30; font-weight: 700; }
   .macro-fill.protein { background: linear-gradient(90deg, #0a84ff, #5e5ce6); }
   .macro-fill.carbs { background: linear-gradient(90deg, #ff9500, #ffb340); }
   .macro-fill.fat { background: linear-gradient(90deg, #34c759, #30d158); }
   
   /* 蛋白质进度条固定区间图层：60%-100% 叠加三段半透明绿色（60-70 浅绿 / 70-80 绿 / 80-100 深绿），
      位于填充条之上可透见，始终显示、与进度值无关；进度条填充本身保持原蓝紫渐变 */
   .protein-zone {
     position: absolute;
     top: 0;
     bottom: 0;
     left: 60%;
     width: 40%;
     z-index: 6;
     pointer-events: none;
     border-radius: 999px;
     background: linear-gradient(90deg,
       rgba(142, 212, 132, 0.38) 0%,
       rgba(142, 212, 132, 0.38) 25%,
       rgba(52, 199, 89, 0.38) 25%,
       rgba(52, 199, 89, 0.38) 50%,
       rgba(32, 150, 92, 0.38) 50%,
       rgba(32, 150, 92, 0.38) 100%
     );
   }
   .progress-fill.macro-fill.protein.over { background: linear-gradient(90deg, #ff9500, #ff3b30); }
   
   /* 宏量营养素提示：推荐线图例 */
   .hint-legend {
     display: inline-flex;
     align-items: center;
     vertical-align: middle;
   }
   .legend-line {
     display: inline-block;
     width: 2px;
     height: 11px;
     margin: 0 5px 0 1px;
     vertical-align: middle;
     /* SVG data‑uri：竖虚线，短线2px，空隙2px；颜色rgba(142,142,147,0.75) */
     background-image: url('data:image/svg+xml;utf8,<svg width="2" height="11" xmlns="http://www.w3.org/2000/svg"><line x1="1" y1="0" x2="1" y2="11" stroke="%238e8e93" stroke-opacity="0.75" stroke-width="2" stroke-dasharray="2 2"/></svg>');
     background-repeat: no-repeat;
     background-position: center;
   }
   
   
   /* ============ 卡片标题行按钮组 ============ */
   .card-actions { display: flex; gap: 8px; align-items: center; }
   
   /* ============ 一键粘贴区 ============ */
   .batch-area {
     border: 1px dashed rgba(10, 132, 255, 0.4);
     background: rgba(10, 132, 255, 0.05);
     border-radius: 14px;
     padding: 12px;
     margin-bottom: 14px;
   }
   .batch-title {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 8px;
     font-size: 13px;
     font-weight: 600;
     color: var(--text);
   }
   .batch-title .btn-mini { margin: 0; }
   .paste-textarea {
     width: 100%;
     min-height: 96px;
     box-sizing: border-box;
     padding: 10px 12px;
     border: 1px solid rgba(0, 0, 0, 0.12);
     border-radius: 12px;
     background: #fff;
     color: var(--text);
     font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
     font-size: 12px;
     line-height: 1.5;
     resize: vertical;
     outline: none;
     margin-bottom: 10px;
   }
   .paste-textarea:focus { border-color: var(--blue); }
   .paste-error {
     margin-top: 8px;
     font-size: 12px;
     color: #ff3b30;
     line-height: 1.6;
     word-break: break-all;
   }
   .manual-divider {
     display: flex;
     align-items: center;
     gap: 10px;
     margin: 14px 0 12px;
     color: var(--text2);
     font-size: 12px;
   }
   .manual-divider::before,
   .manual-divider::after { content: ""; flex: 1; height: 1px; background: rgba(0, 0, 0, 0.08); }
   
   /* ============ 提示词选择 ============ */
   .prompt-grid { display: flex; flex-direction: column; gap: 10px; }
   .modal-desc {
     margin: 0 0 14px;
     font-size: 13px;
     line-height: 1.6;
     color: var(--text2);
   }
   