:root {
  --bg: #f2f4f9;
  --card: #ffffff;
  --ink: #101828;
  --sub: #6b7688;
  --mute: #98a2b3;
  --line: #e7ebf3;
  --brand: #2f5bff;
  --brand-2: #7a4bff;
  --green: #0b9d6b;
  --orange: #e8720c;
  --red: #d92d20;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --r: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ---------------- 入口 ---------------- */
.auth {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
  overflow: auto;
}
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 15% 0%, #2b3a8f 0%, #141c3a 45%, #0b1024 100%),
    #0b1024;
}
.auth-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(122, 75, 255, .55) 0, transparent 42%),
    radial-gradient(circle at 82% 68%, rgba(47, 91, 255, .45) 0, transparent 45%);
  filter: blur(6px);
  opacity: .9;
}
.auth-card {
  position: relative;
  width: 100%; max-width: 380px;
  background: rgba(255, 255, 255, .98);
  border-radius: 22px;
  padding: 26px 22px 22px;
  box-shadow: 0 20px 60px rgba(4, 8, 24, .45);
  animation: rise .45s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(47, 91, 255, .35);
}
.auth-title { font-size: 22px; letter-spacing: .5px; }
.auth-sub { margin: 6px 0 20px; color: var(--sub); font-size: 13px; }
.auth-msg { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--red); }
.auth-foot {
  position: relative; margin-top: 22px;
  color: rgba(255, 255, 255, .5); font-size: 12px;
}

.fl {
  display: block; font-size: 12.5px; color: var(--sub);
  margin: 14px 0 6px; font-weight: 500;
}
.req { color: var(--red); }
input, select, textarea {
  width: 100%;
  font: inherit; color: var(--ink);
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 91, 255, .12);
}
textarea { resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #98a2b3 50%), linear-gradient(135deg, #98a2b3 50%, transparent 50%); background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  border: 1px solid transparent; border-radius: 11px;
  padding: 11px 16px;
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: transform .08s, opacity .15s, background .15s;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 91, 255, .28);
}
.btn-block { width: 100%; margin-top: 18px; padding: 13px; }
.btn.small { padding: 9px 14px; font-size: 14px; white-space: nowrap; }
.btn-danger-ghost {
  width: 100%; margin-top: 10px;
  background: #fff; color: var(--red);
  border-color: #f5c2bd;
}
.btn-outline {
  width: 100%; margin-top: 10px;
  background: #fff; color: var(--brand);
  border-color: #c6d4ff;
}

/* ---------------- 主界面 ---------------- */
.app { min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  background: rgba(242, 244, 249, .92);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(231, 235, 243, .8);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 0 0 4px rgba(47, 91, 255, .12);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.me-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font: inherit; font-weight: 700; font-size: 12px; color: var(--brand);
  cursor: pointer; padding: 0; line-height: 1; white-space: nowrap;
}

.main { max-width: 620px; margin: 0 auto; padding: 14px 14px 24px; }
.panel { animation: fade .22s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 金额三联 */
/* 今日聚焦条：今天该干几件事 */
.today-bar {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
  margin-bottom: 12px;
}
.tb-cell {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 14px; padding: 10px 11px 9px;
  font: inherit; text-align: left; cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.tb-cell:active { transform: scale(.97); }
.tb-n { font-size: 23px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; color: var(--ink); }
.tb-l { font-size: 12px; font-weight: 600; color: var(--sub); }
.tb-sub { font-size: 10.5px; color: var(--mute); margin-top: 2px; }
.tb-cell.hot { border-color: #f6c7c2; background: linear-gradient(180deg, #fff6f5, #fff 60%); }
.tb-cell.hot .tb-n { color: var(--red); }
.tb-cell.hot .tb-sub { color: var(--red); opacity: .8; }
.tb-cell.good { border-color: #b7e6d3; background: linear-gradient(180deg, #f3fdf8, #fff 60%); }
.tb-cell.good .tb-n { color: var(--green); }
.tb-cell.good .tb-sub { color: var(--green); opacity: .85; }
.tb-cell.warn { border-color: #f8d9b6; background: linear-gradient(180deg, #fffaf2, #fff 60%); }
.tb-cell.warn .tb-n { color: var(--orange); }
.tb-cell.warn .tb-sub { color: var(--orange); opacity: .85; }
.tb-cell.clear .tb-n { color: var(--green); }

.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mm {
  background: var(--card); border-radius: 14px; padding: 12px 12px 11px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.mm-label { font-size: 11.5px; color: var(--mute); margin-bottom: 3px; }
.mm-val { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.mm-val small { font-size: 11px; font-weight: 600; color: var(--mute); margin-left: 2px; }
.mm.in .mm-val { color: var(--ink); }
.mm.out .mm-val { color: var(--orange); }
.mm.net .mm-val { color: var(--green); }
.mm.net.neg .mm-val { color: var(--red); }

/* 卡片 */
.card {
  background: var(--card); border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card-head { display: flex; align-items: center; white-space: nowrap; gap: 8px; margin-bottom: 10px; }
.card-head h2 { font-size: 14.5px; flex: 1; }
.card-count {
  font-size: 12px; font-weight: 700; color: var(--brand);
  background: rgba(47, 91, 255, .1);
  padding: 2px 8px; border-radius: 99px;
}
.link-btn {
  border: 0; background: transparent; color: var(--brand);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 0;
}

/* 列表 */
.list { display: flex; flex-direction: column; gap: 8px; }
.list.gap { gap: 10px; }
.empty {
  color: var(--mute); font-size: 13px; text-align: center;
  padding: 18px 8px; line-height: 1.7;
}
.item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 13px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.item:active { background: #f7f9fc; }
.item-l { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 6px;
}
.item-sub {
  font-size: 12.5px; color: var(--sub); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-r { text-align: right; flex-shrink: 0; }
.date-badge {
  font-size: 12.5px; font-weight: 700;
  padding: 3px 7px; border-radius: 8px;
  background: #f1f4fa; color: var(--sub);
}
.date-badge.over { background: #fdecea; color: var(--red); }
.date-badge.today { background: rgba(47, 91, 255, .12); color: var(--brand); }

/* 客户卡片：今日状态一眼分层 */
.cust-row { position: relative; padding-left: 46px; }
.cust-row.st-over { border-color: #f6c7c2; box-shadow: inset 3px 0 0 var(--red); background: #fffafa; }
.cust-row.st-today { border-color: #f8d9b6; box-shadow: inset 3px 0 0 var(--orange); background: #fffdf9; }
.cust-row.st-done { border-color: #c6e8da; box-shadow: inset 3px 0 0 var(--green); background: #fbfefc; }

.qchk {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 25px; height: 25px; border-radius: 50%;
  border: 2px solid #d5dce8; background: #fff;
  color: #fff; font-size: 13px; font-weight: 800; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; flex-shrink: 0;
  transition: transform .12s, border-color .15s, background .15s;
}
.qchk:active { transform: translateY(-50%) scale(.88); }
.qchk.over { border-color: var(--red); background: #fff5f4; }
.qchk.today { border-color: var(--orange); background: #fff8ef; }
.qchk.done { border-color: var(--green); background: var(--green); }

.st-flag {
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 6px;
  background: rgba(11, 157, 107, .12); color: var(--green);
  white-space: nowrap; flex-shrink: 0;
}
.mini-label { font-size: 10.5px; color: var(--mute); margin-bottom: 3px; }

.tag {
  font-size: 10.5px; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 6px;
  background: #eef1f7; color: var(--sub);
  white-space: nowrap; flex-shrink: 0;
}
.tag.hot { background: rgba(47, 91, 255, .12); color: var(--brand); }
.tag.ok { background: rgba(11, 157, 107, .12); color: var(--green); }
.tag.warn { background: #fdf1e3; color: var(--orange); }
.tag.off { background: #f0f1f4; color: var(--mute); }

/* 客户页 */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar input, .toolbar select { flex: 1; }
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: #fff;
  color: var(--sub); font: inherit; font-size: 12.5px;
  padding: 6px 11px; border-radius: 99px; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.seg { display: flex; background: #e9edf5; border-radius: 11px; padding: 3px; flex: 1; }
.seg button {
  flex: 1; border: 0; background: transparent;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--sub);
  padding: 7px 4px; border-radius: 8px; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* 活动卡 */
.act-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 14px;
  cursor: pointer;
}
/* 已结束的活动整体压暗，别抢进行中的视觉 */
.act-card.done { opacity: .62; }
.act-card.done .act-title { color: var(--sub); }
.act-card.done .act-net-val { color: var(--sub); }
.act-sec { margin: 6px 2px 0; font-size: 12.5px; }
.act-sec.live { color: var(--brand); }
.act-sec.end { color: var(--mute); margin-top: 16px; }
.act-mon {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin: 12px 2px 7px; padding: 7px 11px;
  background: #f5f7fb; border-radius: 10px;
}
.act-mon.end { background: #f3f4f6; }
.act-mon-t { font-size: 13px; font-weight: 800; flex-shrink: 0; }
.act-mon-s { font-size: 11.5px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-mon-s b.pos { color: var(--green); }
.act-mon-s b.neg { color: var(--red); }
.act-top { display: flex; gap: 10px; align-items: flex-start; }
.act-title { font-weight: 700; font-size: 15px; line-height: 1.35; }
.act-sub { font-size: 12.5px; color: var(--sub); margin-top: 3px; }
.act-net { text-align: right; flex-shrink: 0; }
.act-net-val { font-size: 16px; font-weight: 800; color: var(--green); }
.act-net-val.neg { color: var(--red); }
.act-bars {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--sub);
}
.act-bars b { color: var(--ink); font-weight: 700; }
.act-more { margin-top: 9px; }
.act-more summary {
  font-size: 12.5px; color: var(--brand); font-weight: 600;
  cursor: pointer; list-style: none; outline: none;
}
.act-more summary::-webkit-details-marker { display: none; }
.act-more summary::after { content: " ▾"; }
.act-more[open] summary::after { content: " ▴"; }
.cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 8px; }
.cost-grid div { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--sub); }
.cost-grid b { color: var(--ink); }

/* 计划 */
.plan-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 12px;
}
.plan-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid #cdd4e0; background: #fff;
  flex-shrink: 0; margin-top: 1px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff;
}
.plan-check.on { background: var(--green); border-color: var(--green); }
.plan-body { flex: 1; min-width: 0; }
.plan-text { font-size: 14px; line-height: 1.45; word-break: break-word; }
.plan-text.done { color: var(--mute); text-decoration: line-through; }
.plan-meta { font-size: 11.5px; color: var(--mute); margin-top: 4px; display: flex; gap: 8px; }
.plan-del { border: 0; background: transparent; color: var(--mute); font-size: 15px; cursor: pointer; padding: 0 2px; }

/* 底部 tab */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1; border: 0; background: transparent;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: inherit; font-size: 11px; color: var(--mute);
  padding: 6px 0; cursor: pointer;
}
.tab i { font-style: normal; font-size: 17px; line-height: 1; }
.tab.on { color: var(--brand); font-weight: 700; }

/* 弹层 */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 24, 40, .42);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .16s ease both;
}
.sheet {
  width: 100%; max-width: 560px;
  max-height: 92vh; overflow: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 6px 16px calc(20px + env(safe-area-inset-bottom));
  animation: up .26s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes up { from { transform: translateY(30px); } to { transform: none; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 4px; position: sticky; top: 0; background: #fff; z-index: 2;
}
.sheet-head h2 { font-size: 16.5px; }
.x {
  border: 0; background: #f1f3f8; color: var(--sub);
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 14px; cursor: pointer;
}
.sheet-body { padding-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.money-block {
  margin-top: 14px; padding: 12px;
  background: #f8fafd; border: 1px solid var(--line); border-radius: 14px;
}
.money-block .fl:first-child { margin-top: 0; }
.calc {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d9e0ec;
  font-size: 12.5px; color: var(--sub);
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px;
}
.calc span { display: flex; justify-content: space-between; }
.calc b { color: var(--ink); }
.calc .calc-net { grid-column: 1 / -1; font-size: 14px; margin-top: 4px; padding-top: 8px; border-top: 1px solid #e6ebf4; }
.calc .calc-net b { font-size: 16px; color: var(--green); }
.calc .calc-net.neg b { color: var(--red); }

.hint { font-size: 12px; color: var(--mute); margin: 8px 0 0; }
.me-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.me-row span { color: var(--sub); }
.me-row b { font-weight: 600; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(16, 24, 40, .92); color: #fff;
  font-size: 13.5px; padding: 10px 16px; border-radius: 99px;
  z-index: 90; white-space: nowrap; max-width: 88vw;
  overflow: hidden; text-overflow: ellipsis;
  animation: fade .18s ease both;
}

/* 分组小标题 */
.group-head {
  font-size: 12px; font-weight: 700; color: var(--mute);
  letter-spacing: .4px;
  margin: 4px 2px 0;
}
.group-head.over { color: var(--red); }
.group-head.today { color: var(--orange); }
.group-head.done { color: var(--green); margin-top: 8px; }
.group-head b { font-weight: 800; }

/* 月度业绩 */
.mrow { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.mrow:first-child { padding-top: 2px; }
.mrow:last-child { border-bottom: 0; padding-bottom: 0; }
.mrow-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.m-mon { font-size: 14px; font-weight: 700; }
.mflag {
  font-size: 10px; font-weight: 700; color: var(--brand);
  background: rgba(47, 91, 255, .1);
  padding: 2px 6px; border-radius: 5px; margin-left: 6px;
  vertical-align: 1px;
}
.m-net { font-size: 14.5px; font-weight: 800; }
.m-net.neg { color: var(--red); }
.mom { font-size: 11px; font-weight: 700; margin-left: 5px; }
.mom.up { color: var(--green); }
.mom.down { color: var(--red); }
.mom.flat { color: var(--mute); }
.m-sub {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 11.5px; color: var(--mute); margin-top: 3px;
}
.m-sub b { color: var(--sub); font-weight: 600; }
.m-total {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--sub); display: flex; justify-content: space-between;
}
.m-total b { color: var(--ink); }

/* 腾讯文档入口条 */
.doc-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 9px 12px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.doc-open {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 7px;
  border: 0; background: transparent; padding: 0; cursor: pointer;
  font: inherit; text-align: left;
}
.doc-ico { font-size: 15px; }
.doc-name {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-state { font-size: 11.5px; color: var(--mute); white-space: nowrap; flex-shrink: 0; }
.doc-state.warn { color: var(--orange); }
.doc-state.err { color: var(--red); }
