:root {
  --bg: #f5f6f8;
  --card: #fff;
  --text: #1a1a1a;
  --muted: #888;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --border: #e5e7eb;
  --danger: #dc2626;
  --green: #16a34a;
  --orange: #ea580c;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: linear-gradient(180deg, #e6ebff 0%, #f5f6f8 280px);
  background-attachment: fixed;
  color: var(--text);
  font-size: 16px;
  padding-bottom: 70px;
}
.container { max-width: 480px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 16px 0 12px; }
h2 { font-size: 17px; margin: 16px 0 8px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-title { font-weight: 600; margin-bottom: 8px; }

button, .btn {
  display: block; width: 100%;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 14px; font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 8px;
}
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { width: auto; display: inline-block; padding: 8px 16px; font-size: 14px; margin: 0; }

input, select, textarea {
  width: 100%; padding: 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 16px; background: #fff; margin-top: 4px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
label { display: block; margin-top: 12px; font-size: 14px; color: #555; font-weight: 500; }

.form-row { display: flex; gap: 8px; }
.form-row > * { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.big-num { font-size: 28px; font-weight: 700; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
}
.tag-main { background: var(--primary-light); color: var(--primary); }
.tag-helper { background: #fef3c7; color: #92400e; }
tag-isolate { background: #f3e8ff; color: #7c3aed; }
.tag-power { background: #fee2e2; color: #991b1b; }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; max-width: 480px; margin: 0 auto;
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 0 8px;
  text-decoration: none; color: var(--muted); font-size: 11px;
}
.tabbar a.active { color: var(--primary); }
.tabbar a .icon { font-size: 22px; display: block; }

/* 动作项 */
.exercise-item {
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  position: relative;
  border: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease;
}
/* 已完成态 */
.exercise-item.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.done-badge {
  display: none;
  position: absolute; top: 10px; right: 10px;
  background: var(--green); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}
.exercise-item.done .done-badge { display: inline-block; }
.exercise-name { font-weight: 600; font-size: 16px; }
.exercise-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.weight-range { color: var(--primary); font-weight: 600; margin-top: 6px; font-size: 15px; }

/* 分组标题 */
.group-header {
  display: flex; justify-content: space-between; align-items: center;
  margin: 16px 0 8px; font-weight: 600;
}

/* 历史记录 */
.log-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.log-row:last-child { border-bottom: none; }
.log-name { font-weight: 500; }
.log-detail { color: var(--muted); font-size: 13px; margin-top: 2px; }
.log-weight { text-align: right; font-weight: 600; }

/* 登录页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-box { width: 100%; max-width: 360px; }
.auth-box h1 { text-align: center; }

/* 录入弹窗（内联展开） */
.log-form {
  margin-top: 12px; padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }

canvas { width: 100%; height: 240px; }

/* 历史页 改/删 小按钮 */
.mini-btn {
  width: auto; display: inline-block; padding: 3px 10px;
  font-size: 12px; font-weight: 500; margin: 0;
  background: #eef0f3; color: #555; border-radius: 6px;
}
.mini-btn.danger { background: #fee2e2; color: var(--danger); }

/* 历史页内联编辑面板 */
.edit-panel {
  margin: 8px 0 4px; padding: 12px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
}

/* 分段切换按钮（重量/容量） */
.seg { display: flex; gap: 8px; margin-top: 10px; }
.seg-btn {
  flex: 1; margin: 0; padding: 9px;
  background: #eef0f3; color: #555;
  font-size: 14px; font-weight: 500; border-radius: 8px;
}
.seg-btn.active { background: var(--primary); color: #fff; }
