:root {
  --bg-primary: #0D0D1A;
  --bg-secondary: #16162A;
  --bg-card: #1E1E3A;
  --bg-card-hover: #282850;
  --bg-input: #2A2A4A;
  --text-primary: #F0F0FF;
  --text-secondary: #A0A0C0;
  --text-muted: #606080;
  --accent-primary: #6C63FF;
  --accent-secondary: #FF6584;
  --accent-green: #00E676;
  --accent-orange: #FFAB40;
  --accent-blue: #40C4FF;
  --accent-red: #FF5252;
  --gradient-primary: linear-gradient(135deg, #6C63FF, #FF6584);
  --border-color: #2E2E50;
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --border-radius-sm: 8px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --sidebar-width: 260px;
  --header-height: 64px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:var(--font-family); background:var(--bg-primary); color:var(--text-primary); min-height:100vh; overflow-x:hidden; }
::-webkit-scrollbar { width:6px; }
::-webkit-scrollbar-track { background:var(--bg-secondary); }
::-webkit-scrollbar-thumb { background:var(--border-color); border-radius:3px; }

.app-layout { display:flex; min-height:100vh; }

.sidebar {
  width:var(--sidebar-width); background:var(--bg-secondary);
  border-right:1px solid var(--border-color); display:flex; flex-direction:column;
  position:fixed; top:0; left:0; bottom:0; z-index:100;
  transition:transform 0.3s ease;
}
.sidebar-logo { padding:20px; display:flex; align-items:center; gap:12px; border-bottom:1px solid var(--border-color); }
.sidebar-logo .logo-icon { width:36px; height:36px; background:var(--gradient-primary); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; font-weight:bold; color:white; }
.sidebar-logo h1 { font-size:18px; font-weight:700; background:var(--gradient-primary); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.sidebar-nav { flex:1; padding:12px 8px; overflow-y:auto; }

.nav-item {
  display:flex; align-items:center; gap:12px; padding:12px 16px;
  border-radius:var(--border-radius); color:var(--text-secondary);
  cursor:pointer; transition:all 0.2s ease; margin-bottom:2px; font-size:14px;
}
.nav-item:hover { background:var(--bg-card); color:var(--text-primary); }
.nav-item.active { background:var(--gradient-primary); color:white; font-weight:600; }
.nav-item .nav-icon { width:22px; text-align:center; font-size:18px; }
.nav-item .nav-badge { margin-left:auto; background:var(--accent-secondary); color:white; font-size:11px; padding:2px 8px; border-radius:10px; font-weight:600; }

.sidebar-footer { padding:16px; border-top:1px solid var(--border-color); }
.user-mini-card { display:flex; align-items:center; gap:10px; padding:10px; border-radius:var(--border-radius); background:var(--bg-card); }
.user-avatar { width:36px; height:36px; border-radius:50%; background:var(--gradient-primary); display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; color:white; }
.user-mini-info { flex:1; min-width:0; }
.user-mini-info .name { font-size:13px; font-weight:600; color:var(--text-primary); }
.user-mini-info .goal { font-size:11px; color:var(--text-muted); }

.main-content { flex:1; margin-left:var(--sidebar-width); min-height:100vh; }

.app-header {
  height:var(--header-height); background:var(--bg-secondary);
  border-bottom:1px solid var(--border-color);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 24px; position:sticky; top:0; z-index:50;
}
.header-left { display:flex; align-items:center; gap:12px; }
.header-left h2 { font-size:18px; font-weight:600; }
.header-left .page-subtitle { font-size:13px; color:var(--text-muted); }
.header-right { display:flex; align-items:center; gap:12px; }
.header-date { font-size:13px; color:var(--text-muted); }
.header-btn { width:36px; height:36px; border-radius:50%; border:1px solid var(--border-color); background:var(--bg-card); color:var(--text-secondary); cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.2s; font-size:16px; }
.header-btn:hover { background:var(--bg-card-hover); color:var(--text-primary); }
.menu-toggle { display:none; width:36px; height:36px; border-radius:var(--border-radius-sm); border:1px solid var(--border-color); background:var(--bg-card); color:var(--text-secondary); cursor:pointer; align-items:center; justify-content:center; font-size:18px; }

.page-content { padding:24px; }
.page-section { display:none; }
.page-section.active { display:block; }

.card { background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--border-radius-lg); padding:20px; margin-bottom:16px; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-title { font-size:16px; font-weight:600; display:flex; align-items:center; gap:8px; }
.card-action { color:var(--accent-primary); font-size:13px; cursor:pointer; background:none; border:none; font-family:inherit; }

.dashboard-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px,1fr)); gap:16px; margin-bottom:24px; align-items:start; }

.macro-progress-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(120px,1fr)); gap:12px; }
.macro-ring-item { text-align:center; padding:16px 8px; background:var(--bg-secondary); border-radius:var(--border-radius); }
.macro-ring { position:relative; width:80px; height:80px; margin:0 auto 8px; }
.macro-ring svg { transform:rotate(-90deg); }
.macro-ring .ring-bg { fill:none; stroke:var(--bg-input); stroke-width:8; }
.macro-ring .ring-progress { fill:none; stroke-width:8; stroke-linecap:round; transition:stroke-dashoffset 0.8s ease; }
.macro-ring .ring-center { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); text-align:center; }
.ring-center .value { font-size:18px; font-weight:700; display:block; line-height:1.2; }
.ring-center .unit { font-size:10px; color:var(--text-muted); }
.macro-label { font-size:12px; color:var(--text-secondary); font-weight:500; }
.macro-sub { font-size:11px; color:var(--text-muted); margin-top:2px; }
.quick-gap { height:8px; }
.progress-track { width:100%; height:8px; border-radius:4px; background:var(--bg-input); overflow:hidden; margin-top:16px; }
.progress-value { height:100%; width:0; border-radius:4px; background:var(--gradient-primary); transition:width 0.5s ease; }
.progress-value.over { background:var(--accent-red); }
.macro-ring-item.over .ring-center .value { color:var(--accent-secondary); }
.macro-ring-item.over .ring-progress { stroke:var(--accent-secondary); }

.info-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px,1fr)); gap:10px; }
.info-item { display:flex; flex-direction:column; gap:4px; padding:10px 12px; background:var(--bg-input); border-radius:var(--border-radius-sm); }
.info-label { font-size:12px; color:var(--text-muted); }
.info-value { font-size:15px; font-weight:600; color:var(--text-primary); }
.info-wide { grid-column:1/-1; }

.pill { display:inline-flex; align-items:center; gap:4px; padding:2px 10px; border-radius:12px; font-size:11px; font-weight:600; }
.pill-training { background:rgba(108,99,255,0.2); color:#B9B4FF; }
.pill-rest { background:rgba(64,196,255,0.15); color:var(--accent-blue); }
.pill-muted { background:var(--bg-input); color:var(--text-muted); }

.kcal-check { margin-top:12px; padding:12px 14px; border-radius:var(--border-radius-sm); background:var(--bg-input); border-left:3px solid var(--accent-orange); font-size:13px; line-height:1.6; color:var(--text-secondary); }
.kcal-check .check-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }

.bmi-tip { margin-top:12px; padding:10px 12px; border-radius:var(--border-radius-sm); background:var(--bg-input); font-size:12px; line-height:1.6; color:var(--text-secondary); }

.calorie-summary { display:flex; flex-direction:column; align-items:center; padding:24px 0; }
.big-calorie { font-size:48px; font-weight:800; background:var(--gradient-primary); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.calorie-label { font-size:14px; color:var(--text-muted); margin-top:4px; }
.calorie-remaining { font-size:14px; color:var(--text-secondary); margin-top:8px; }
.calorie-remaining span { font-weight:600; color:var(--accent-green); }
.calorie-remaining #dashRemainingLabel { color:var(--text-secondary); font-weight:400; }

.form-group { margin-bottom:16px; }
.form-group label { display:block; font-size:13px; font-weight:500; color:var(--text-secondary); margin-bottom:6px; }
.form-input { width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); color:var(--text-primary); font-size:14px; font-family:inherit; transition:border-color 0.2s; }
.form-input:focus { outline:none; border-color:var(--accent-primary); }
.form-select { width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); color:var(--text-primary); font-size:14px; font-family:inherit; cursor:pointer; appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23A0A0C0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; }
.form-select:focus { outline:none; border-color:var(--accent-primary); }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.form-row-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }

.btn { padding:10px 20px; border:none; border-radius:var(--border-radius); font-size:14px; font-weight:600; cursor:pointer; font-family:inherit; transition:all 0.2s ease; display:inline-flex; align-items:center; gap:8px; }
.btn-primary { background:var(--gradient-primary); color:white; }
.btn-primary:hover { opacity:0.9; transform:translateY(-1px); }
.btn-secondary { background:var(--bg-card); color:var(--text-primary); border:1px solid var(--border-color); }
.btn-secondary:hover { background:var(--bg-card-hover); }
.btn-success { background:var(--accent-green); color:var(--bg-primary); }
.btn-danger { background:var(--accent-red); color:white; }
.btn-sm { padding:6px 12px; font-size:12px; }
.btn-block { width:100%; justify-content:center; }

.onboarding-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,0.85); z-index:1000;
  display:none; align-items:center; justify-content:center;
  backdrop-filter:blur(8px);
}
.onboarding-overlay.show { display:flex; }
.onboarding-card { background:var(--bg-secondary); border:1px solid var(--border-color); border-radius:var(--border-radius-lg); width:480px; max-width:90vw; max-height:90vh; overflow-y:auto; padding:32px; }
.onboarding-header { text-align:center; margin-bottom:24px; }
.onboarding-header h2 { font-size:22px; margin-bottom:8px; }
.onboarding-header p { color:var(--text-muted); font-size:14px; }
.step-indicators { display:flex; justify-content:center; gap:8px; margin-bottom:24px; }
.step-dot { width:8px; height:8px; border-radius:50%; background:var(--border-color); transition:all 0.3s; }
.step-dot.active { background:var(--accent-primary); width:24px; border-radius:4px; }
.step-dot.completed, .step-dot.done { background:var(--accent-green); }
.onboarding-nav { display:flex; justify-content:space-between; margin-top:24px; gap:12px; }

.meal-card { background:var(--bg-secondary); border-radius:var(--border-radius); padding:16px; margin-bottom:12px; cursor:pointer; transition:all 0.2s; border:1px solid transparent; }
.meal-card:hover { border-color:var(--border-color); background:var(--bg-card); }
.meal-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.meal-type { font-size:13px; font-weight:600; display:flex; align-items:center; gap:6px; }
.meal-time { font-size:12px; color:var(--text-muted); }
.meal-totals { display:flex; gap:16px; font-size:12px; color:var(--text-secondary); }
.meal-totals span { display:flex; align-items:center; gap:4px; }
.meal-totals .cal { color:var(--accent-primary); }
.meal-totals .pro { color:var(--accent-blue); }
.meal-totals .carb { color:var(--accent-orange); }
.meal-totals .fat { color:var(--accent-secondary); }
.meal-date-bar { display:flex; align-items:center; gap:8px; margin-bottom:16px; flex-wrap:wrap; }
.meal-date-bar .meal-date-input.input { flex:0 0 auto; width:170px; }
.meal-date-bar .btn-date-nav { width:34px; padding:6px 0; justify-content:center; font-size:16px; }

.input { width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); color:var(--text-primary); font-size:14px; font-family:inherit; transition:border-color 0.2s; }
.input:focus { outline:none; border-color:var(--accent-primary); }
.input::placeholder { color:var(--text-muted); }
.input-group { display:flex; flex-direction:column; gap:6px; }
.input-group label { font-size:13px; font-weight:500; color:var(--text-secondary); }
.input-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

.food-item { display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); cursor:pointer; transition:all 0.2s; }
.food-item:hover { background:var(--bg-card-hover); border-color:var(--accent-primary); }

.meal-group { background:var(--bg-secondary); border:1px solid var(--border-color); border-radius:var(--border-radius); padding:14px; margin-bottom:12px; }
.meal-group-header { display:flex; justify-content:space-between; align-items:center; padding-bottom:10px; border-bottom:1px solid var(--border-color); margin-bottom:8px; font-weight:600; font-size:14px; }
.meal-item { display:flex; align-items:center; gap:10px; padding:10px 6px; border-bottom:1px solid var(--border-color); }
.meal-item:last-child { border-bottom:none; }
.meal-item-name { font-size:14px; font-weight:500; }
.meal-item-note { font-size:12px; color:var(--text-muted); margin-top:2px; }
.meal-item-cal { font-size:14px; font-weight:700; color:var(--accent-primary); }
.meal-item-macro { font-size:11px; color:var(--text-muted); margin-top:2px; }
.btn-icon { width:28px; height:28px; border-radius:50%; border:none; background:var(--bg-input); color:var(--text-muted); cursor:pointer; display:inline-flex; align-items:center; justify-content:center; font-size:12px; transition:all 0.2s; }
.btn-icon:hover { background:var(--accent-red); color:white; }

.modal-tabs { display:flex; gap:8px; }
.modal-tab { flex:1; padding:8px 10px; border-radius:var(--border-radius-sm); border:1px solid var(--border-color); background:transparent; color:var(--text-muted); font-size:13px; font-weight:500; cursor:pointer; font-family:inherit; transition:all 0.2s; }
.modal-tab:hover { border-color:var(--accent-primary); color:var(--text-primary); }
.modal-tab.active { background:var(--gradient-primary); color:white; border-color:transparent; }

.ai-upload-area { border:2px dashed var(--border-color); border-radius:var(--border-radius-lg); padding:40px; text-align:center; cursor:pointer; transition:all 0.3s; background:var(--bg-secondary); }
.ai-upload-area:hover { border-color:var(--accent-primary); background:var(--bg-card); }
.ai-upload-area .upload-icon { font-size:48px; margin-bottom:12px; }
.ai-upload-area p { color:var(--text-muted); font-size:14px; }
.ai-result-card { background:var(--bg-secondary); border-radius:var(--border-radius); padding:16px; margin-top:16px; }
.ai-image-grid { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.ai-thumb { position:relative; width:84px; height:84px; border-radius:var(--border-radius-sm); overflow:hidden; border:1px solid var(--border-color); background:var(--bg-input); }
.ai-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.ai-thumb .thumb-remove { position:absolute; top:2px; right:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(0,0,0,0.6); color:#fff; font-size:11px; cursor:pointer; line-height:1; }
.ai-item { background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); padding:12px; margin-bottom:10px; }
.ai-item-top { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; }
.ai-item-top .ai-food-name { flex:1; }
.ai-item input.input { padding:6px 10px; font-size:13px; }
.ai-grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:8px; }
.ai-grid-4 .input-group label { font-size:11px; }
.ai-status { padding:12px; border-radius:var(--border-radius-sm); background:var(--bg-input); font-size:13px; color:var(--text-secondary); line-height:1.6; }
.ai-spinner { display:inline-block; width:16px; height:16px; border:2px solid var(--border-color); border-top-color:var(--accent-primary); border-radius:50%; animation:spin 0.8s linear infinite; vertical-align:-3px; margin-right:6px; }
@keyframes spin { to { transform:rotate(360deg); } }

.record-list { display:flex; flex-direction:column; }
.body-record-item .record-values { color:var(--text-secondary); }
.record-warn { font-size:11px; color:var(--accent-orange); margin-top:2px; }

.food-item.selected { border-color:var(--accent-primary); background:var(--bg-card-hover); }
.modal.modal-lg { width:640px; max-height:86vh; }
.ai-food-item { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border-color); }
.ai-food-item:last-child { border-bottom:none; }
.ai-food-name { font-weight:500; font-size:14px; }
.ai-food-nutrition { font-size:12px; color:var(--text-muted); }
.confidence-badge { font-size:11px; padding:2px 8px; border-radius:10px; font-weight:500; }
.confidence-high { background:rgba(0,230,118,0.15); color:var(--accent-green); }
.confidence-medium { background:rgba(255,171,64,0.15); color:var(--accent-orange); }
.confidence-low { background:rgba(255,82,82,0.15); color:var(--accent-red); }

.report-card { background:var(--bg-secondary); border-radius:var(--border-radius); padding:20px; margin-bottom:16px; }
.report-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.report-header h3 { font-size:16px; }
.report-period { display:flex; gap:8px; }
.period-btn { padding:4px 12px; border-radius:16px; border:1px solid var(--border-color); background:transparent; color:var(--text-muted); cursor:pointer; font-size:12px; font-family:inherit; transition:all 0.2s; }
.period-btn.active { background:var(--accent-primary); border-color:var(--accent-primary); color:white; }
.report-stats { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px,1fr)); gap:12px; }
.stat-item { text-align:center; padding:12px; background:var(--bg-card); border-radius:var(--border-radius); }
.stat-value { font-size:24px; font-weight:700; display:block; }
.stat-label { font-size:12px; color:var(--text-muted); margin-top:4px; }
.stat-good { color:var(--accent-green); }
.stat-warn { color:var(--accent-orange); }
.stat-bad { color:var(--accent-red); }

.profile-header-card { text-align:center; padding:32px 20px; background:var(--bg-card); border-radius:var(--border-radius-lg); border:1px solid var(--border-color); margin-bottom:16px; }
.profile-avatar, .profile-avatar-large { width:80px; height:80px; border-radius:50%; background:var(--gradient-primary); display:flex; align-items:center; justify-content:center; font-size:32px; font-weight:700; color:white; margin:0 auto 12px; }
.profile-name { font-size:20px; font-weight:700; margin-bottom:8px; }
.profile-goal-badge { display:inline-block; padding:4px 14px; border-radius:16px; font-size:12px; font-weight:600; background:var(--bg-input); color:var(--text-secondary); }
.profile-bmi-display { display:inline-block; padding:4px 12px; border-radius:16px; font-size:12px; font-weight:500; margin-top:8px; }
.bmi-normal { background:rgba(0,230,118,0.15); color:var(--accent-green); }
.bmi-underweight { background:rgba(64,196,255,0.15); color:var(--accent-blue); }
.bmi-overweight { background:rgba(255,171,64,0.15); color:var(--accent-orange); }
.bmi-obese { background:rgba(255,82,82,0.15); color:var(--accent-red); }

.body-record-item { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--border-color); }
.body-record-item:last-child { border-bottom:none; }
.record-date { font-size:13px; color:var(--text-muted); }
.record-values { display:flex; gap:16px; font-size:14px; }
.body-weight-chart { height:200px; background:var(--bg-secondary); border-radius:var(--border-radius); display:flex; align-items:flex-end; gap:4px; padding:16px 8px; }
.chart-bar { flex:1; background:var(--gradient-primary); border-radius:3px 3px 0 0; min-height:4px; transition:height 0.5s ease; position:relative; }

.settings-group { margin-bottom:24px; }
.settings-group h3 { font-size:14px; color:var(--text-muted); margin-bottom:12px; text-transform:uppercase; letter-spacing:0.5px; }
.settings-item { display:flex; justify-content:space-between; align-items:center; padding:14px 0; border-bottom:1px solid var(--border-color); }
.settings-item:last-child { border-bottom:none; }
.settings-item-info { flex:1; }
.settings-item-info .label { font-size:14px; font-weight:500; }
.settings-item-info .desc { font-size:12px; color:var(--text-muted); margin-top:2px; }
.settings-item-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; justify-content:flex-end; }

.page-actions { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; }
.page-actions .btn { flex:1 1 auto; justify-content:center; }

.toggle { position:relative; width:44px; height:24px; cursor:pointer; }
.toggle input { display:none; }
.toggle .slider { position:absolute; inset:0; background:var(--bg-input); border-radius:12px; transition:all 0.3s; }
.toggle .slider:before { content:''; position:absolute; width:18px; height:18px; border-radius:50%; background:white; top:3px; left:3px; transition:all 0.3s; }
.toggle input:checked + .slider { background:var(--accent-primary); }
.toggle input:checked + .slider:before { transform:translateX(20px); }
.toggle input:disabled + .slider { opacity:0.45; cursor:not-allowed; }

.modal-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.7); z-index:500; display:none; align-items:center; justify-content:center; backdrop-filter:blur(4px); }
.modal-overlay.show, .modal-overlay.open { display:flex; }
.modal { background:var(--bg-secondary); border:1px solid var(--border-color); border-radius:var(--border-radius-lg); width:480px; max-width:90vw; max-height:80vh; overflow-y:auto; padding:24px; }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.modal-header h3 { font-size:18px; }
.modal-close { width:32px; height:32px; border-radius:50%; border:none; background:var(--bg-input); color:var(--text-muted); cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:16px; }

.achievement-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(100px,1fr)); gap:12px; }
.achievement-item { text-align:center; padding:16px 8px; background:var(--bg-secondary); border-radius:var(--border-radius); border:1px solid var(--border-color); transition:all 0.2s; }
.achievement-item.unlocked { border-color:var(--accent-green); background:rgba(0,230,118,0.05); }
.achievement-icon { font-size:28px; margin-bottom:8px; }
.achievement-name { font-size:11px; color:var(--text-muted); font-weight:500; }
.achievement-item.locked { opacity:0.5; filter:grayscale(0.8); }

.notification { position:fixed; top:20px; right:20px; padding:14px 20px; border-radius:var(--border-radius); background:var(--bg-card); border:1px solid var(--border-color); box-shadow:var(--shadow-lg); z-index:2000; display:flex; align-items:center; gap:10px; font-size:14px; transform:translateX(120%); transition:transform 0.3s ease; max-width:360px; }
.notification.show { transform:translateX(0); }
.notification.success { border-left:3px solid var(--accent-green); }
.notification.error { border-left:3px solid var(--accent-red); }
.notification.info { border-left:3px solid var(--accent-blue); }
.notification.warning { border-left:3px solid var(--accent-orange); }

.food-search-input { position:relative; }
.food-search-input input { padding-right:40px; }
.search-results { position:absolute; top:100%; left:0; right:0; background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--border-radius-sm); max-height:250px; overflow-y:auto; z-index:10; display:none; }
.search-results.show { display:block; }
.search-result-item { padding:10px 14px; cursor:pointer; border-bottom:1px solid var(--border-color); transition:background 0.2s; }
.search-result-item:hover { background:var(--bg-card-hover); }
.search-result-item:last-child { border-bottom:none; }

.chart-container { width:100%; height:200px; display:flex; align-items:flex-end; gap:6px; padding:10px 0; }
#weightChart, #bmiChart { height:auto; min-height:280px; display:block; }
#macroChart { height:auto; display:block; padding:0; }
.bar-wrapper { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; }
.bar-fill { width:100%; border-radius:4px 4px 0 0; min-height:2px; transition:height 0.5s ease; }
.bar-label { font-size:10px; color:var(--text-muted); white-space:nowrap; }

.unit-toggle { display:inline-flex; background:var(--bg-input); border-radius:var(--border-radius-sm); overflow:hidden; }
.unit-option { padding:6px 12px; font-size:12px; cursor:pointer; color:var(--text-muted); transition:all 0.2s; border:none; background:none; font-family:inherit; }
.unit-option.active { background:var(--accent-primary); color:white; }

.empty-state { text-align:center; padding:40px 20px; color:var(--text-muted); }
.empty-state .empty-icon { font-size:48px; margin-bottom:12px; }
.empty-state p { font-size:14px; }

.fade-in { animation:fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

@media (max-width:768px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .main-content { margin-left:0; }
  .menu-toggle { display:flex; }
  .dashboard-grid { grid-template-columns:1fr; }
  .form-row { grid-template-columns:1fr; }
  .form-row-3 { grid-template-columns:1fr; }
  .onboarding-card { padding:20px; width:100%; max-height:100vh; border-radius:0; }
  .macro-progress-grid { grid-template-columns:repeat(2,1fr); }
  .report-stats { grid-template-columns:repeat(2,1fr); }
}

/* ==========================================================================
   UI 优化层（选项卡片 / 提示条 / 快捷操作 / 引导进度 / 细节打磨）
   ========================================================================== */

:root {
  --focus-ring: 0 0 0 3px rgba(108,99,255,0.28);
  --card-border-hover: #35355F;
}

html { color-scheme: dark; }

/* ---------- 选项卡片（活动水平 / 健身目标 / 目标强度） ---------- */
.radio-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px 44px 14px 16px;
  background: var(--bg-input); border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius); cursor: pointer; user-select: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.radio-card:hover { border-color: var(--card-border-hover); background: var(--bg-card-hover); transform: translateY(-1px); }
.radio-card:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.radio-card.selected {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, rgba(108,99,255,0.18), rgba(255,101,132,0.10));
  box-shadow: 0 0 0 1px var(--accent-primary) inset, 0 6px 18px rgba(108,99,255,0.16);
}
.radio-card.selected::after {
  content: '✓'; position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--gradient-primary);
  color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.radio-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .radio-icon { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; }
.radio-card .radio-title { font-size: 14px; font-weight: 600; }
.radio-card .radio-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.radio-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-card-grid .radio-card { flex-direction: column; text-align: center; gap: 6px; padding: 16px 10px; align-items: center; }
.radio-card-grid .radio-card.selected::after { top: 8px; right: 8px; transform: none; width: 18px; height: 18px; font-size: 11px; }

.radio-list { display: flex; flex-direction: column; gap: 8px; }
.radio-card .radio-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radio-card .radio-body .radio-title,
.radio-card .radio-body .radio-desc { display: block; }
.radio-card-grid .radio-card .radio-body { align-items: center; }
.radio-card-grid .radio-card .radio-desc { max-width: 100%; }
.input-hint { margin-top: 12px; font-size: 12px; line-height: 1.65; color: var(--text-muted); }

/* ---------- 引导流程进度 ---------- */
.onb-steps { display: flex; gap: 6px; margin: 4px 0 20px; }
.onb-step { flex: 1; height: 5px; border-radius: 3px; background: var(--border-color); transition: background .3s ease; }
.onb-step.done { background: linear-gradient(90deg, #6C63FF, #8d86ff); opacity: .55; }
.onb-step.active { background: var(--gradient-primary); box-shadow: 0 0 12px rgba(108,99,255,0.5); }
.onb-step-title { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 14px; }
.onb-step-title b { color: var(--accent-primary); }

/* ---------- 提示条 ---------- */
.notice {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px;
  background: var(--bg-card); border: 1px solid var(--border-color); border-left: 3px solid var(--accent-primary);
  border-radius: var(--border-radius); margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.notice-warn { border-left-color: var(--accent-orange); }
.notice-info { border-left-color: var(--accent-blue); }
.notice-accent { border-left-color: var(--accent-secondary); }
.notice-icon { font-size: 22px; line-height: 1.2; flex: 0 0 auto; }
.notice-body { flex: 1; min-width: 0; }
.notice-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.notice-text { font-size: 13px; line-height: 1.65; color: var(--text-secondary); }
.notice-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.notice-actions .btn { padding: 7px 14px; font-size: 12.5px; }

/* ---------- 快捷操作 ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 18px 10px; min-height: 92px; border-radius: var(--border-radius);
  background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-primary);
  font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .18s ease;
}
.quick-action:hover { border-color: var(--accent-primary); background: var(--bg-card-hover); transform: translateY(-2px); }
.quick-action .qa-icon { font-size: 24px; line-height: 1; }
.quick-action.qa-primary {
  background: linear-gradient(135deg, rgba(108,99,255,0.24), rgba(255,101,132,0.16));
  border-color: rgba(108,99,255,0.5);
}

/* ---------- 设置分组 ---------- */
.settings-group { margin-bottom: 22px; }
.settings-group > h3 {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 10px; padding-left: 2px;
}
.settings-group .card { margin-bottom: 0; }

/* ---------- 细节打磨 ---------- */
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.btn-primary { box-shadow: 0 6px 18px rgba(108,99,255,0.28); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(108,99,255,0.35); }
.card { box-shadow: var(--shadow-sm); }
.input:hover { border-color: var(--card-border-hover); }
.input:focus { box-shadow: var(--focus-ring); }
.empty-state { padding: 34px 20px; }
.empty-state .empty-icon {
  width: 76px; height: 76px; margin: 0 auto 14px; font-size: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-input); border-radius: 50%;
}
.meal-item, .body-record-item { transition: background .18s ease; }
.meal-item:hover, .body-record-item:hover { background: rgba(255,255,255,0.025); border-radius: var(--border-radius-sm); }
.stat-item { transition: transform .18s ease, background .18s ease; }
.stat-item:hover { transform: translateY(-2px); background: var(--bg-card-hover); }
.macro-ring-item { transition: transform .18s ease, background .18s ease; }
.macro-ring-item:hover { transform: translateY(-2px); background: var(--bg-card-hover); }
.app-header { background: rgba(22,22,42,0.88); backdrop-filter: blur(8px); }
.nav-item.active { box-shadow: 0 6px 18px rgba(108,99,255,0.28); }
.modal-overlay.show .modal, .onboarding-overlay.show .onboarding-card { animation: popIn .22s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.ai-upload-area:active { transform: scale(.995); }
.ai-item input.input { background: var(--bg-secondary); }

@media (max-width: 768px) {
  .page-content { padding: 16px 14px 40px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .radio-card-grid { grid-template-columns: 1fr; }
  .notice { flex-direction: column; gap: 10px; }
  .onboarding-card .onb-step-title { font-size: 11px; }
}

/* ============================================================
   健身训练模块（工作记录 / 组数明细 / 身材照片 AI 分析）
   ============================================================ */
.modal-actions { display:flex; flex-wrap:wrap; gap:10px; }

.accent-blue { color: var(--accent-blue); }
.accent-orange { color: var(--accent-orange); }
.accent-green { color: var(--accent-green); }
.accent-secondary { color: var(--accent-secondary); }

.pill-accent { background: rgba(108,99,255,.18); color: var(--accent-primary); }

/* ---- 当日概览 ---- */
.gym-day-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; flex-wrap:wrap; }
.gym-day-date { font-size:14px; color:var(--text-secondary); font-weight:600; }

.gym-stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(140px, 1fr)); gap:12px; margin-bottom:16px; }
.gym-stat {
  background:var(--bg-card); border:1px solid var(--border-color);
  border-radius:var(--border-radius); padding:14px 16px;
}
.gym-stat-value { font-size:22px; font-weight:700; line-height:1.2; }
.gym-stat-unit { font-size:12px; font-weight:500; color:var(--text-muted); margin-left:4px; }
.gym-stat-label { font-size:12px; color:var(--text-muted); margin-top:4px; }

/* ---- 训练卡片 ---- */
.workout-list { display:flex; flex-direction:column; gap:12px; margin-bottom:16px; }
.workout-card {
  background:var(--bg-card); border:1px solid var(--border-color);
  border-radius:var(--border-radius); padding:14px 16px; transition:border-color .2s;
}
.workout-card:hover { border-color:var(--accent-primary); }
.workout-head { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.workout-title { display:flex; align-items:center; gap:8px; min-width:0; }
.workout-name { font-size:15px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.workout-actions { display:flex; gap:6px; flex-shrink:0; }
.muscle-pill {
  font-size:11px; font-weight:600; padding:2px 8px; border-radius:10px;
  background:rgba(64,196,255,.16); color:var(--accent-blue); flex-shrink:0;
}

.set-table { margin-top:10px; border-radius:var(--border-radius-sm); overflow:hidden; }
.set-row {
  display:grid; grid-template-columns:52px 1fr 1fr 1fr; gap:8px;
  padding:7px 10px; font-size:13px; background:var(--bg-input);
  border-bottom:1px solid var(--border-color);
}
.set-row:last-child { border-bottom:none; }
.set-row.set-head { font-size:11px; color:var(--text-muted); font-weight:600; background:transparent; }
.set-index { color:var(--text-muted); }

.workout-foot {
  display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px;
  margin-top:10px; font-size:12px; color:var(--text-muted);
}
.volume-bar { height:4px; background:var(--bg-input); border-radius:2px; margin-top:8px; overflow:hidden; }
.volume-fill { height:100%; background:var(--gradient-primary); border-radius:2px; }
.workout-note { margin-top:8px; font-size:12px; color:var(--text-secondary); font-style:italic; }

/* ---- 周频率 ---- */
.gym-week-chart { display:flex; flex-direction:column; gap:8px; }
.week-bar-row { display:grid; grid-template-columns:110px 1fr auto; align-items:center; gap:10px; font-size:12px; }
.week-bar-label { color:var(--text-muted); }
.week-bar-track { height:8px; background:var(--bg-input); border-radius:4px; overflow:hidden; }
.week-bar-fill { height:100%; background:var(--gradient-primary); border-radius:4px; transition:width .3s; }
.week-bar-value { color:var(--text-secondary); white-space:nowrap; }

/* ---- 组数编辑器 ---- */
.workout-form { display:flex; flex-direction:column; gap:14px; padding:4px 0; }
.set-editor-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.set-editor-head label { font-size:13px; color:var(--text-secondary); font-weight:600; }
.set-editor { display:flex; flex-direction:column; gap:8px; }
.set-editor-row {
  display:grid; grid-template-columns:64px 1fr 34px 1fr 34px 28px;
  align-items:center; gap:8px;
}
.set-editor-index { font-size:12px; color:var(--text-muted); }
.set-editor-unit { font-size:12px; color:var(--text-muted); }
.set-editor-total { font-size:12px; color:var(--text-muted); text-align:right; padding-top:2px; }

/* ---- 身材照片 ---- */
.body-analysis-form { display:flex; flex-direction:column; gap:14px; padding:4px 0; }
.body-photo-preview { display:flex; flex-direction:column; gap:8px; }
.body-photo-preview img { width:100%; max-height:320px; object-fit:contain; border-radius:var(--border-radius); background:var(--bg-secondary); }
.body-photo-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; }

.context-details { font-size:12px; color:var(--text-muted); }
.context-details summary { cursor:pointer; padding:8px 0; }
.context-details pre {
  white-space:pre-wrap; word-break:break-word; background:var(--bg-input);
  border-radius:var(--border-radius-sm); padding:10px 12px; margin-top:6px;
  font-size:11px; line-height:1.7; color:var(--text-secondary); max-height:220px; overflow:auto;
}

.body-photo-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:12px; }
.body-photo-card { background:var(--bg-input); border-radius:var(--border-radius); overflow:hidden; }
.body-photo-card img { width:100%; height:170px; object-fit:cover; cursor:pointer; display:block; }
.body-photo-nophoto {
  height:170px; display:flex; align-items:center; justify-content:center; text-align:center;
  font-size:12px; color:var(--text-muted); cursor:pointer; background:var(--bg-secondary);
}
.body-photo-info { display:flex; align-items:center; justify-content:space-between; gap:6px; padding:8px 10px; }
.body-photo-date { font-size:11px; color:var(--text-muted); }
.body-photo-actions { display:flex; gap:4px; }

/* ---- 分析结果 ---- */
.analysis-card {
  margin-top:14px; background:var(--bg-secondary); border:1px solid var(--border-color);
  border-radius:var(--border-radius); padding:16px;
}
.analysis-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:10px; }
.analysis-head-title { font-size:15px; font-weight:700; }
.analysis-summary {
  font-size:13px; line-height:1.75; color:var(--text-secondary);
  padding:10px 12px; background:var(--bg-input); border-radius:var(--border-radius-sm); margin-bottom:12px;
}
.analysis-block { margin-top:14px; }
.analysis-title { font-size:13px; font-weight:700; margin-bottom:8px; }
.analysis-list { list-style:none; display:flex; flex-direction:column; gap:6px; }
.analysis-list li {
  font-size:13px; line-height:1.65; color:var(--text-secondary);
  padding-left:14px; position:relative;
}
.analysis-list li::before { content:'·'; position:absolute; left:4px; color:var(--text-muted); }
.analysis-list.list-good li::before { content:'✅'; font-size:10px; left:0; }
.analysis-list.list-warn li::before { content:'⚠️'; font-size:10px; left:0; }
.analysis-kv { display:flex; flex-direction:column; gap:6px; margin-bottom:8px; }
.analysis-kv > div { display:flex; justify-content:space-between; gap:12px; font-size:13px; }
.analysis-kv span { color:var(--text-muted); flex-shrink:0; }
.analysis-kv b { text-align:right; font-weight:600; }
.analysis-note { font-size:12px; color:var(--text-muted); line-height:1.6; }
.analysis-item { padding:10px 12px; background:var(--bg-input); border-radius:var(--border-radius-sm); margin-bottom:8px; }
.analysis-item-title { font-size:13px; font-weight:600; margin-bottom:4px; }
.analysis-item-detail { font-size:13px; line-height:1.65; color:var(--text-secondary); }
.analysis-disclaimer {
  margin-top:16px; padding:10px 12px; border-radius:var(--border-radius-sm);
  background:rgba(255,171,64,.10); border-left:3px solid var(--accent-orange);
  font-size:12px; line-height:1.65; color:var(--text-secondary);
}

@media (max-width: 768px) {
  .week-bar-row { grid-template-columns:88px 1fr; }
  .week-bar-value { grid-column:2; font-size:11px; }
  .set-editor-row { grid-template-columns:56px 1fr 26px 1fr 26px 26px; gap:5px; }
  .gym-stat-grid { grid-template-columns:repeat(2, 1fr); }
}