/* 冠军干活了吗 — 苹果健康风格：黄主色 + 深蓝点缀，圆角卡片，移动优先 */
:root {
  --yellow: #F7B500;
  --yellow-deep: #B57F00;
  --yellow-soft: #FFF6E0;
  --yellow-50: #FFFBF0;
  --blue: #185FA5;
  --blue-deep: #0C447C;
  --blue-soft: #E6F1FB;
  --green: #0F9D58;
  --red: #E24B4A;
  --bg: #F6F6F4;
  --card: #FFFFFF;
  --text: #1C1C1A;
  --text-2: #6E6E68;
  --text-3: #9C9C96;
  --line: rgba(28,28,26,.10);
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(28,28,26,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55;
}
.hidden { display: none !important; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 15px; width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(247,181,0,.45); border-color: var(--yellow); }
textarea { min-height: 84px; resize: vertical; }
label.fld { display: block; margin-bottom: 12px; }
label.fld > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, var(--yellow-soft), var(--bg) 45%); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 36px 28px; box-shadow: var(--shadow); text-align: center; }
.auth-logo { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; background: var(--yellow); color: #fff; font-size: 34px; font-weight: 500; display: flex; align-items: center; justify-content: center; }
.auth-card h1 { font-size: 20px; font-weight: 500; }
.auth-sub { color: var(--text-2); font-size: 13px; margin: 4px 0 20px; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.seg-btn { flex: 1; padding: 9px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.seg-btn.active { background: #fff; color: var(--text); font-weight: 500; box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.form-msg { font-size: 13px; min-height: 18px; color: var(--red); }
.form-msg.ok { color: var(--green); }
.form-msg.info { color: var(--blue); }

/* ---------- 主框架 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 10px; background: rgba(246,246,244,.92); backdrop-filter: blur(12px);
}
.topbar-title { font-size: 22px; font-weight: 500; }
.topbar-user { font-size: 13px; color: var(--text-2); max-width: 45%; text-align: right; }
#main { padding: 4px 16px 110px; max-width: 720px; margin: 0 auto; }
.page { animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-title { font-size: 13px; color: var(--text-2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.card-title .link { color: var(--blue); font-size: 13px; }

/* 打分卡 */
.score-card { background: linear-gradient(135deg, #FFDF8E, var(--yellow)); color: #3D2B00; }
.score-card .score-num { font-size: 52px; font-weight: 500; line-height: 1.1; }
.score-card .score-num small { font-size: 18px; font-weight: 400; }
.score-dims { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.score-dim { background: rgba(255,255,255,.55); border-radius: 12px; padding: 8px 6px; text-align: center; }
.score-dim b { display: block; font-size: 15px; font-weight: 500; }
.score-dim span { font-size: 11px; opacity: .8; }

/* 速览 */
.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qs { text-align: center; }
.qs b { display: block; font-size: 24px; font-weight: 500; color: var(--blue-deep); }
.qs span { font-size: 12px; color: var(--text-2); }

/* 待办 */
.todo-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: none; }
.todo-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--text-3); flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; }
.todo-check.done { background: var(--green); border-color: var(--green); }
.todo-body { flex: 1; min-width: 0; }
.todo-body b { font-weight: 500; font-size: 14px; }
.todo-body .sub { font-size: 12px; color: var(--text-2); }
.todo-flag { font-size: 11px; padding: 2px 8px; border-radius: 20px; flex: none; }
.flag-overdue { background: #FCEBEB; color: var(--red); }
.flag-soon { background: var(--yellow-soft); color: var(--yellow-deep); }
.flag-type { background: var(--blue-soft); color: var(--blue); }
.todo-del { color: var(--text-3); font-size: 12px; padding: 4px 6px; }

/* 按钮 */
.btn-primary { display: block; width: 100%; padding: 13px; border-radius: 14px; background: var(--yellow); color: #3D2B00; font-size: 16px; font-weight: 500; text-align: center; }
.btn-primary:active { opacity: .85; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-danger-ghost { background: #FCEBEB; color: var(--red); }
.btn-sm { padding: 9px 12px; font-size: 13px; border-radius: 10px; display: inline-block; min-height: 38px; line-height: 20px; white-space: nowrap; }
.row-btns { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.row-btns > * { flex: 1 1 0; min-width: 0; }
/* 手机端：多按钮一行放不下时自动两列，避免文字被挤成两行 */
@media (max-width: 420px) { .row-btns > * { flex: 1 1 calc(50% - 4px); } }

/* 底部导航 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  background: rgba(255,255,255,.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-3); padding: 4px 0; }
.tab.active { color: var(--yellow-deep); }
.tab-ico { font-size: 19px; line-height: 1; }
.tab-fab {
  width: 54px; height: 54px; margin: -26px auto 4px; border-radius: 50%;
  background: var(--yellow); color: #fff; font-size: 28px; font-weight: 300;
  box-shadow: 0 4px 14px rgba(247,181,0,.45); display: flex; align-items: center; justify-content: center;
}
.tab-fab:active { transform: scale(.94); }

/* 列表项 */
.cust-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cust-item:last-child { border-bottom: none; }
.avatar { width: 42px; height: 42px; border-radius: 13px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 500; color: #fff; }
.cust-body { flex: 1; min-width: 0; }
.cust-body b { font-weight: 500; font-size: 15px; }
.cust-body .sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 20px; flex: none; }
.badge-A { background: #FCEBEB; color: #A32D2D; }
.badge-B { background: var(--yellow-soft); color: var(--yellow-deep); }
.badge-C { background: var(--blue-soft); color: var(--blue); }
.badge-D { background: #F1EFE8; color: var(--text-2); }

/* 搜索行 */
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; min-width: 0; }
.search-row select { width: 104px; flex: none; }
/* 筛选行：多个下拉并排，等宽自适应，手机端不挤压 */
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; }
.filter-row select { flex: 1; min-width: 0; }

/* ---------- 弹层 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(28,28,26,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s; }
@media (min-width: 640px) { .modal-mask { align-items: center; } }
.modal { position: relative; background: #fff; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal { border-radius: 22px; } }
.modal h3 { position: sticky; top: -20px; z-index: 3; background: #fff; font-size: 17px; font-weight: 500; margin: -4px 0 12px; padding: 12px 0 8px; text-align: center; }
.modal-close { position: absolute; top: 10px; right: 0; width: 32px; height: 32px; color: var(--text-3); font-size: 20px; line-height: 30px; text-align: center; background: transparent; z-index: 4; }
.action-sheet-btn { display: block; width: 100%; text-align: left; padding: 15px 14px; border-radius: 14px; background: var(--bg); margin-bottom: 10px; }
.action-sheet-btn b { font-weight: 500; }
.action-sheet-btn .sub { display: block; font-size: 12px; color: var(--text-2); }

/* Toast */
#toast-root { position: fixed; top: 14px; left: 0; right: 0; z-index: 99; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: rgba(28,28,26,.88); color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 22px; animation: fadeIn .2s; max-width: 86vw; }

/* 提醒横幅 */
#reminder-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90; background: var(--yellow); color: #3D2B00;
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500;
}
#reminder-banner button { margin-left: auto; background: rgba(255,255,255,.7); border-radius: 16px; padding: 4px 12px; font-size: 12px; }

/* 录音 */
.rec-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.rec-btn { width: 46px; height: 46px; border-radius: 50%; background: #FCEBEB; color: var(--red); font-size: 20px; flex: none; display: flex; align-items: center; justify-content: center; }
.rec-btn.recording { background: var(--red); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(226,75,74,.4);} 50% { box-shadow: 0 0 0 10px rgba(226,75,74,0);} }
.rec-status { font-size: 13px; color: var(--text-2); flex: 1; }
.file-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--blue); font-size: 12px; padding: 4px 10px; border-radius: 14px; margin: 4px 6px 0 0; }
.file-tag a { color: inherit; }

/* 图表容器 */
.chart-box { position: relative; height: 220px; }
.chart-box canvas { width: 100% !important; }
.seg-sm { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; }
.seg-sm button { flex: 1; padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.seg-sm button.active { background: #fff; color: var(--text); box-shadow: var(--shadow); font-weight: 500; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 8px 0 14px; }
.tl-item::before { content: ""; position: absolute; left: -17px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); border: 2px solid #fff; }
.tl-item.deal::before { background: var(--red); }
.tl-item .tl-time { font-size: 11px; color: var(--text-3); }
.tl-item .tl-title { font-size: 14px; font-weight: 500; }
.tl-item .tl-body { font-size: 13px; color: var(--text-2); white-space: pre-wrap; }
.tl-actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tl-actions button { font-size: 13px; color: var(--blue); padding: 7px 10px; min-height: 34px; border-radius: 8px; background: var(--bg); }
.tl-actions button.danger { color: var(--red); }

/* 空态 */
.empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 26px 0; }

/* 成员看板表格 */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--text-2); font-weight: 400; padding: 7px 6px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: none; }

/* 电脑端适配 */
@media (min-width: 720px) {
  #main { max-width: 860px; }
  .quick-stats { gap: 16px; }
  body { font-size: 15px; }
  .topbar { max-width: 860px; margin: 0 auto; }
}

/* ---------- PWA / 窄屏适配补充 ---------- */
.donut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 359px) {
  .donut-grid { grid-template-columns: 1fr; }
  .chart-box { height: 180px; }
}
/* 触摸目标下限：纯文字小按钮在窄屏也留出可点高度 */
@media (max-width: 400px) {
  .todo-del, .link, .tl-actions button { min-height: 28px; display: inline-flex; align-items: center; }
}
