/* N+ 教练助理 · 样式。浅色（训练区光线亮、单手操作），铜色取自 N+ 品牌姓名牌。
   只有浅色主题：本产品不做深色模式（纯亮色产品不加深色媒体查询）。 */
:root {
  --bg: #f4f2ee; --card: #ffffff; --ink: #17171a; --ink2: #4a4843; --mute: #6b675f;
  --line: #e4e0d8; --line2: #efece6;
  --brand: #9a5315; --brand-ink: #ffffff; --brand-soft: #f6ebdf; --brand-line: #e7cfb5;
  --ok: #1f7a4d; --ok-soft: #e4f3ea; --warn: #8a5a00; --warn-soft: #fbf0d9;
  --bad: #b3261e; --bad-soft: #fdecea; --info: #28579c; --info-soft: #e7eef9;
  --r: 14px; --r-sm: 10px; --shadow: 0 1px 2px rgba(20, 16, 10, .06), 0 4px 14px rgba(20, 16, 10, .05);
  --tabh: 64px; --safe: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ico { display: inline-flex; flex: none; }
.ico svg { width: 100%; height: 100%; }
.app.locked { overflow: hidden; }
#view { max-width: 720px; margin: 0 auto; padding: 0 16px calc(var(--tabh) + var(--safe) + 24px); min-height: 100vh; }
.boot { padding: 40vh 0; text-align: center; color: var(--mute); }

/* 顶栏 */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  margin: 0 -16px 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(244, 242, 238, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line2); }
.top-title { flex: 1; min-width: 0; }
header.top h1 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 800; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub { font-size: 13px; color: var(--mute); }
.icon-btn { width: 42px; height: 42px; border: 0; background: transparent; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn .ico { width: 22px; height: 22px; }
.icon-btn:active { background: var(--line2); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: #fff;
  font-weight: 700; font-size: 15px; display: grid; place-items: center; flex: none; }

/* 底部导航：4 个 Tab，按一天的使用顺序（FLOW §4） */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabh) + var(--safe)); padding-bottom: var(--safe);
  background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.tab { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--mute); font-size: 12px; position: relative; font-weight: 600; }
.tab .ico { width: 24px; height: 24px; }
.tab.on { color: var(--brand); }
.tab .dot { position: absolute; top: 7px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; font-weight: 700; }

/* 卡片与分组 */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.card.tight { padding: 4px 0; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 2px 8px;
  font-size: 13px; font-weight: 700; color: var(--mute); letter-spacing: .02em; }
.sec-title .count { color: var(--ink2); }
.sec-title a, .sec-title button { font-size: 13px; color: var(--brand); border: 0; background: none; font-weight: 700; padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; border-bottom: 1px solid var(--line2);
  text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--line2); }
.row .main { flex: 1; min-width: 0; }
.row .t1 { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .side { text-align: right; font-size: 13px; color: var(--ink2); flex: none; }
.time { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 16px; width: 50px; flex: none; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* 徽标 */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  font-weight: 700; background: var(--line2); color: var(--ink2); white-space: nowrap; }
.chip.k-trial { background: var(--info-soft); color: var(--info); }
.chip.k-regular { background: #eceae4; color: #3f3c36; }
.chip.k-special { background: var(--brand-soft); color: var(--brand); }
.chip.k-group { background: #efe7f7; color: #6a3d99; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.brand { background: var(--brand); color: #fff; }

/* 禁忌 / 疼痛红条：永远放在最显眼处（FLOW §3） */
.redline { display: flex; gap: 8px; align-items: flex-start; background: var(--bad-soft); color: var(--bad);
  border-radius: var(--r-sm); padding: 8px 12px; font-size: 13.5px; font-weight: 600; margin-top: 8px; }
.redline .ico { width: 18px; height: 18px; margin-top: 1px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; color: var(--ink); }
.btn .ico { width: 19px; height: 19px; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row > .btn { flex: 1; }

/* 表单 */
.field { display: block; margin-bottom: 12px; }
.field .lab { display: block; font-size: 13px; font-weight: 700; color: var(--ink2); margin-bottom: 5px; }
.field .hint { display: block; font-size: 12.5px; color: var(--mute); margin-top: 4px; }
input.in, select.in, textarea.in { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; outline: none; }
textarea.in { min-height: 84px; resize: vertical; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--line2); border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 38px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; }
.pill.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-height: 46px; }
.search input { flex: 1; border: 0; outline: 0; font-size: 16px; background: transparent; min-width: 0; }
.search .ico { width: 20px; height: 20px; color: var(--mute); }

/* 底部弹层 */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(20, 18, 14, .42); display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { width: 100%; max-width: 720px; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 8px 16px calc(18px + var(--safe)); overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #cfcac0; margin: 4px auto 10px; }
.sheet h3 { margin: 4px 0 4px; font-size: 18px; font-weight: 800; }
.sheet .hint { color: var(--mute); font-size: 13.5px; margin-bottom: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabh) + var(--safe) + 18px); transform: translateX(-50%); z-index: 90;
  max-width: calc(100vw - 32px); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14.5px;
  display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 26px rgba(0,0,0,.25); }
.toast-act { border: 0; background: transparent; color: #f5c48f; font-weight: 800; }

.empty { text-align: center; color: var(--mute); padding: 36px 16px; }
.empty .big { font-size: 17px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* 登录页 */
.auth { max-width: 400px; margin: 0 auto; padding: 12vh 22px 40px; }
.auth .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth .logo svg { width: 44px; height: auto; color: var(--ink); }
.auth .logo b { font-size: 22px; font-weight: 800; }
.auth .logo span { display: block; font-size: 13px; color: var(--mute); font-weight: 500; }
.err { color: var(--bad); font-size: 14px; min-height: 22px; margin: 4px 0; font-weight: 600; }

/* 签名板 */
.sign-headline { font-size: 19px; font-weight: 800; line-height: 1.4; padding: 6px 2px 4px; }
.signwrap { position: relative; margin-top: 8px; }
.signpad { display: block; width: 100%; height: 230px; background: #fff; border: 2px dashed var(--brand-line);
  border-radius: 14px; touch-action: none; -webkit-user-select: none; user-select: none; }
.sign-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: #b9b2a6; font-size: 13px; pointer-events: none; }
.sigthumb { height: 40px; max-width: 120px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }

/* 上课页 */
.member-switch { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 10px; }
.ex-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; }
.ex-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 6px; }
.ex-head .name { flex: 1; font-weight: 800; font-size: 16.5px; border: 0; background: none; text-align: left; padding: 0; }
.set-row { display: grid; grid-template-columns: 30px 1fr 18px 1fr 44px 34px; align-items: center; gap: 6px; padding: 5px 12px; }
.set-row.two { grid-template-columns: 30px 1fr 44px 34px; }
.set-row .idx { color: var(--mute); font-weight: 700; font-size: 13px; text-align: center; }
.set-row input { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; text-align: center;
  font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; background: #fff; }
.set-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.set-row .x { color: var(--mute); text-align: center; font-size: 13px; }
.done-btn { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; color: transparent; }
.done-btn .ico { width: 22px; height: 22px; }
.done-btn.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.set-row.undone input { background: #faf8f4; color: var(--mute); }
.unit-lab { display: grid; grid-template-columns: 30px 1fr 18px 1fr 44px 34px; gap: 6px; padding: 0 12px; font-size: 11.5px; color: var(--mute); text-align: center; }
.unit-lab.two { grid-template-columns: 30px 1fr 44px 34px; }
.ex-foot { display: flex; gap: 8px; padding: 6px 12px 12px; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + var(--safe)); z-index: 25; padding: 10px 16px;
  background: linear-gradient(180deg, rgba(244,242,238,0), rgba(244,242,238,.96) 30%); }
.bottom-bar .inner { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; }
.bottom-bar .btn { flex: 1; }
.pad-bottom { height: 84px; }

/* 口述 */
.voice-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px; margin: 4px 0 12px;
  border-radius: 16px; border: 2px dashed var(--brand-line); background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 17px; }
.voice-btn .ico { width: 24px; height: 24px; }
.rec-live { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px 0 10px; font-weight: 800; font-size: 26px; font-variant-numeric: tabular-nums; }
.rec-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--bad); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }

/* 助手 */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 4px; }
.bottom-bar .inner .in { min-height: 46px; }
