:root {
  --brand: #8C1C3A;
  --brand-soft: #fbeef1;
  --ink: #1b1c22;
  --ink-2: #4b4d57;
  --muted: #8a8d99;
  --line: #e8eaf0;
  --line-2: #f1f3f7;
  --bg: #f5f6f8;
  --card: #ffffff;
  --green: #1f7a4d;
  --green-soft: #e9f5ee;
  --red: #c0392b;
  --red-soft: #fdecea;
  --amber: #a9701a;
  --amber-soft: #fdf3e3;
  --blue: #1f4e79;
  --blue-soft: #eaf1f8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 22, 30, .04), 0 6px 20px rgba(20, 22, 30, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- 布局 ---------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 208px; flex: 0 0 208px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 20px 18px 16px; border-bottom: 1px solid var(--line-2); }
.brand h1 { margin: 0; font-size: 15px; letter-spacing: .5px; color: var(--brand); font-weight: 700; }
.brand span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); letter-spacing: .3px; }

.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 10.5px; color: var(--muted); letter-spacing: 1px; padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  color: var(--ink-2); font-size: 13px; user-select: none;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--line-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .45; }
.nav-item.active .dot { opacity: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex: 0 0 56px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-size: 14px; font-weight: 600; }
.topbar .spacer { flex: 1; }
.year-select {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.year-select input {
  width: 70px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 7px; text-align: center; font-weight: 600; color: var(--brand);
}
.save-state { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.save-state .led { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.save-state.saving .led { background: var(--amber); }
.save-state.error .led { background: var(--red); }

.content { padding: 20px 22px 70px; flex: 1; }

/* ---------- 通用 ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.page-head .sub { color: var(--muted); font-size: 12px; padding-bottom: 2px; }
.page-head .grow { flex: 1; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-head .hint { font-size: 11.5px; color: var(--muted); }
.card-head .grow { flex: 1; }
.card-body { padding: 14px 16px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 12.5px; color: var(--ink-2);
  transition: all .12s; white-space: nowrap;
}
.btn:hover { border-color: #cfd3dd; background: #fafbfc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #7a1731; border-color: #7a1731; }
.btn-danger { color: var(--red); border-color: #f1cfcb; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }

.search {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff;
}
.search input { border: 0; outline: 0; width: 170px; background: transparent; }
.search input::placeholder { color: #b6b9c3; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi .label { font-size: 11.5px; color: var(--muted); letter-spacing: .3px; }
.kpi .value { font-size: 23px; font-weight: 700; margin-top: 6px; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.kpi.accent { background: linear-gradient(180deg, #fff 0%, #fffcfd 100%); border-color: #f0dde2; }
.kpi.accent .value { color: var(--brand); }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 250px); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fbfcfd; border-bottom: 1px solid var(--line);
  padding: 9px 10px; text-align: left; font-weight: 600; color: var(--ink-2);
  white-space: nowrap; font-size: 11.8px;
}
table.grid tbody td {
  padding: 7px 9px; border-bottom: 1px solid var(--line-2); vertical-align: middle;
  white-space: nowrap;
}
table.grid tbody td.long {
  white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
table.grid tbody tr:hover { background: #fbfcfe; }
table.grid tbody tr[data-act] { cursor: pointer; }
table.grid tbody tr.total { background: #fafafc; font-weight: 600; }
table.grid tbody tr.total td { border-top: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.link { color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* 操作列固定在右侧，横向滚动时始终可见 */
table.grid thead th:last-child,
table.grid tbody td:last-child {
  position: sticky; right: 0; background: #fff;
  box-shadow: -8px 0 10px -8px rgba(20, 22, 30, .18);
}
table.grid thead th:last-child { background: #fbfcfd; z-index: 3; }
table.grid tbody tr:hover td:last-child { background: #fbfcfe; }
table.grid tbody tr.total td:last-child { background: #fafafc; }

.row-del { color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 5px; }
.row-del:hover { color: var(--red); background: var(--red-soft); }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .2px;
}
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.bad { background: var(--red-soft); color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--blue); }
.badge.plain { background: var(--line-2); color: var(--ink-2); }

/* ---------- 图表条 ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 88px 1fr 72px 56px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 18px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #b43557, var(--brand)); border-radius: 5px; transition: width .4s; }
.bar-fill.blue { background: linear-gradient(90deg, #3f7fb8, var(--blue)); }
.bar-fill.green { background: linear-gradient(90deg, #4a9e73, var(--green)); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- 提示条 ---------- */
.notice {
  border-radius: 10px; padding: 11px 14px; font-size: 12.5px;
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 14px;
  background: var(--amber-soft); color: #7a5312; border: 1px solid #f3e2c4;
}
.notice.good { background: var(--green-soft); color: #1a6440; border-color: #cfe9da; }
.notice.bad { background: var(--red-soft); color: #8f2a20; border-color: #f6d4d0; }
.notice b { font-weight: 700; }

/* ---------- 表单弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 22, 30, .38);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 100; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff; border-radius: 14px; width: 760px; max-width: 100%;
  box-shadow: 0 24px 60px rgba(20, 22, 30, .22);
  animation: pop .14s ease-out;
}
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: .6; } }
.modal.narrow { width: 520px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.modal-head .grow { flex: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot [data-del-rec] { margin-right: auto; }
.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 13px 20px; border-top: 1px solid var(--line-2); background: #fcfcfd;
  border-radius: 0 0 14px 14px;
}

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; color: var(--muted); letter-spacing: .2px; }
.field label .req { color: var(--brand); margin-left: 2px; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; outline: none; width: 100%; transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(140, 28, 58, .07);
}
.field input[readonly] { background: #f7f8fa; color: var(--ink-2); }
.field input.diff { border-color: #e2b45c; background: #fffcf4; }
.field .help { font-size: 11px; color: var(--muted); }
.field .calc {
  padding: 8px 10px; border-radius: 8px; background: var(--brand-soft);
  color: var(--brand); font-weight: 700; font-variant-numeric: tabular-nums;
}
.form-section { grid-column: 1 / -1; font-size: 11.5px; color: var(--muted); letter-spacing: .6px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--line); }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #1f2029; color: #fff; padding: 10px 18px; border-radius: 9px;
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
  z-index: 300; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { background: #a3271c; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 6px; font-size: 13.5px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); font-weight: 600; color: var(--brand); }

.cols-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
}
/* ---------- 顶栏：账号 ---------- */
.burger {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 16px; cursor: pointer; color: var(--ink-2);
}
.who { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.who-name { color: var(--ink-2); font-weight: 600; }
.who-role { color: var(--muted); background: var(--line-2); padding: 1px 7px; border-radius: 20px; font-size: 11px; }
.who .btn { padding: 3px 9px; font-size: 11.5px; }

/* ---------- 登录 ---------- */
.login-wrap[hidden] { display: none !important; }
.login-wrap {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #fbeef1 0%, #f5f6f8 60%);
  padding: 24px;
}
.login-card {
  width: 360px; max-width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(20,22,30,.10);
  padding: 34px 30px 26px; text-align: center;
}
.login-mark {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px; background: var(--brand); color: #fff;
  font-size: 28px; font-weight: 700; line-height: 56px; letter-spacing: 0;
}
.login-card h1 { margin: 0; font-size: 20px; letter-spacing: 1px; color: var(--brand); }
.login-sub { margin: 5px 0 22px; font-size: 12px; color: var(--muted); }
.login-card label {
  display: block; text-align: left; font-size: 12px; color: var(--muted);
  margin-bottom: 12px;
}
.login-card input {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(140,28,58,.08); }
.login-btn { width: 100%; justify-content: center; padding: 11px; margin-top: 8px; font-size: 14px; }
.login-err { min-height: 18px; margin-top: 10px; font-size: 12px; color: var(--red); }

/* ---------- 移动端 ---------- */
.backdrop { display: none; }

@media (max-width: 820px) {
  .burger { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: 236px; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 8px 0 30px rgba(20,22,30,.12);
    display: flex;
  }
  #app.nav-open .sidebar { transform: none; }
  #app.nav-open .backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(20,22,30,.38); z-index: 55;
  }
  .topbar { padding: 0 12px; gap: 8px; height: 52px; flex: 0 0 52px; }
  .topbar .title { font-size: 13.5px; }
  .year-select { font-size: 11px; }
  .year-select input { width: 58px; padding: 4px 6px; }
  .who-role { display: none; }
  .who-name { display: none; }
  .content { padding: 12px 12px 70px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h2 { font-size: 16px; }
  .page-head .sub { font-size: 11px; width: 100%; }
  .page-head .search { order: 3; width: 100%; }
  .page-head .search input { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 17px; }
  .kpi .label { font-size: 11px; }
  .kpi .meta { font-size: 10.5px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; gap: 12px; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .field.wide, .field.full { grid-column: 1 / -1; }
  .modal { width: 100%; border-radius: 14px; }
  .modal-body { padding: 14px; }
  .overlay { padding: 12px; }
  .bar-row { grid-template-columns: 74px 1fr 72px 46px; font-size: 11.5px; }
  .card-head { padding: 11px 12px; }
  .card-head h3 { font-size: 12.5px; }
  table.grid { font-size: 12px; }
  table.grid thead th, table.grid tbody td { padding: 7px 8px; }
}

/* ============================================================
   移动版界面
   ============================================================ */

/* 附件 */
.attach { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 13px; }
.attach.busy { opacity: .55; pointer-events: none; }
.attach-title { font-size: 11.5px; color: var(--muted); margin-bottom: 9px; }
.attach-title span { margin-left: 8px; color: #b8bbc4; }
.attach-list { display: flex; flex-wrap: wrap; gap: 9px; }
.attach-item { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f7f8fa; }
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.attach-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(20,22,30,.66); color: #fff; font-size: 13px; line-height: 20px;
  padding: 0; cursor: pointer;
}
.attach-add {
  width: 76px; height: 76px; border-radius: 10px; border: 1px dashed #ccd1db;
  display: flex; align-items: center; justify-content: center; font-size: 25px;
  color: #a9adb8; cursor: pointer; background: #fafbfc; transition: .12s;
}
.attach-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.attach-paste { flex-direction: column; gap: 2px; font-size: 19px; line-height: 1; padding: 0; }
.attach-paste small { font-size: 11px; letter-spacing: .4px; }
.attach-paste:active { border-color: var(--brand); color: var(--brand); }
body.mobile .attach-paste { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 700; background: rgba(10,11,15,.88);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 86vh; border-radius: 10px; }
.lightbox-x { position: absolute; bottom: 26px; color: #fff; opacity: .55; font-size: 12px; }

/* 骨架 */
#tabbar { display: none; }
body.mobile #tabbar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -6px 24px rgba(20,22,30,.07);
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 8px 0 7px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 10.5px;
}
.tab-ico { font-size: 17px; line-height: 1; }
.tab.on { color: var(--brand); font-weight: 600; }
.tab.primary .tab-ico {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  margin-top: -15px; box-shadow: 0 6px 16px rgba(140,28,58,.36);
}
.tab.primary .tab-txt { margin-top: 1px; }

body.mobile .sidebar { display: none; }
body.mobile .burger { display: none; }
body.mobile .backdrop { display: none !important; }
body.mobile .topbar { height: 50px; flex: 0 0 50px; padding: 0 14px; }
body.mobile .topbar .title { font-size: 15px; }
body.mobile .who-name, body.mobile .who-role { display: none; }
body.mobile .save-state { display: none; }
body.mobile .content { padding: 12px 12px 92px; }
body.mobile .page-head { display: none; }

body.mobile .overlay { padding: 0; align-items: stretch; }
body.mobile .modal { width: 100%; border-radius: 0; min-height: 100vh; box-shadow: none; }
body.mobile .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; }
body.mobile .modal-foot { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px)); }
body.mobile .form-grid { grid-template-columns: 1fr 1fr; }
body.mobile .field.wide, body.mobile .field.full { grid-column: 1 / -1; }

/* 首页 */
.m-hero {
  background: linear-gradient(135deg, #8C1C3A 0%, #b43a5f 100%);
  border-radius: 16px; padding: 18px 18px 14px; color: #fff;
  margin-bottom: 13px; box-shadow: 0 10px 26px rgba(140,28,58,.24);
}
.m-hero-row { display: flex; justify-content: space-between; gap: 12px; }
.m-hero-right { text-align: right; }
.m-hero-label { font-size: 11.5px; opacity: .78; }
.m-hero-value { font-size: 25px; font-weight: 700; margin-top: 5px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.m-hero-value.alt { font-size: 21px; }
.m-hero-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 11.5px; opacity: .72; }

.m-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 13px; }
.m-quick-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 11px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; font-size: 12px; color: var(--ink-2); box-shadow: var(--shadow);
}
.m-quick-btn b { color: var(--brand); font-size: 15px; line-height: 1; }
.m-quick-btn:active { transform: scale(.97); }

.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 13px; }
.m-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow);
}
.m-stat span { font-size: 11px; color: var(--muted); }
.m-stat b { font-size: 15px; font-variant-numeric: tabular-nums; }

.m-card { background: #fff; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 13px; overflow: hidden; box-shadow: var(--shadow); }
.m-card-head {
  padding: 11px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between;
}
.m-card-head em { font-style: normal; color: var(--brand); }
.m-todo, .m-kv, .m-line { display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.m-todo:last-child, .m-kv:last-child, .m-line:last-child { border-bottom: 0; }
.m-todo b { color: var(--red); font-variant-numeric: tabular-nums; }
.m-kv b { font-variant-numeric: tabular-nums; }
.m-line { cursor: pointer; }
.m-line-t { font-size: 13px; }
.m-line-s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.m-line b { font-variant-numeric: tabular-nums; }

.m-ok { background: var(--green-soft); color: #1a6440; border-radius: 12px; padding: 12px 14px; font-size: 12.5px; margin-bottom: 13px; }
.m-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0; }

/* 列表 */
.m-search { margin-bottom: 10px; }
.m-search input {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; outline: none; font-size: 13px;
}
.m-search input:focus { border-color: var(--brand); }
.m-sum { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); padding: 0 3px 10px; }
.m-seg { display: flex; background: var(--line-2); border-radius: 10px; padding: 3px; margin-bottom: 11px; }
.m-seg button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.m-seg button.on { background: #fff; font-weight: 600; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.07); }

.m-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 9px; box-shadow: var(--shadow); cursor: pointer; }
.m-item:active { background: #fcfcfd; }
.m-item-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.m-item-date { font-size: 11px; color: var(--muted); }
.m-item-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.m-item-t { font-size: 14px; font-weight: 600; line-height: 1.35; }
.m-item-s { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.m-item-amt { text-align: right; display: flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.m-item-amt b { font-size: 16px; font-variant-numeric: tabular-nums; }
.m-item-amt span { font-size: 11.5px; }
.m-clip { font-size: 10px; color: var(--muted); }
.red { color: var(--red) !important; }
.green { color: var(--green) !important; }
.muted { color: var(--muted) !important; }

.m-tag { padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 600; }
.m-tag.info { background: var(--blue-soft); color: var(--blue); }
.m-tag.ok { background: var(--green-soft); color: var(--green); }
.m-tag.warn { background: var(--amber-soft); color: var(--amber); }
.m-tag.bad { background: var(--red-soft); color: var(--red); }

.m-fab {
  position: fixed; right: 18px; bottom: 84px; width: 54px; height: 54px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 27px; display: flex; align-items: center;
  justify-content: center; box-shadow: 0 8px 22px rgba(140,28,58,.38); cursor: pointer;
  z-index: 45; padding-bottom: 3px;
}
.m-fab:active { transform: scale(.94); }

/* 更多 */
.m-menu-item { display: flex; align-items: center; gap: 8px; padding: 13px 14px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; cursor: pointer; color: inherit; }
.m-menu-item:last-child { border-bottom: 0; }
.m-menu-item span { flex: 1; }
.m-menu-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.m-menu-item i { font-style: normal; color: #c3c7d1; font-size: 16px; }
.m-menu-item:active { background: #fafbfc; }
.m-key { padding: 11px 14px; font-size: 11.5px; color: var(--muted); }
.m-foot { text-align: center; font-size: 11px; color: #b8bbc4; padding: 18px 0 8px; line-height: 1.7; }

/* 记一笔 */
.m-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.m-add-card {
  border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 20px 14px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; cursor: pointer;
  box-shadow: var(--shadow); text-align: left;
}
.m-add-card b { font-size: 15px; color: var(--ink); }
.m-add-card span { font-size: 11.5px; color: var(--muted); }
.m-add-card.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; padding: 16px 18px; }
.m-add-card.wide span { margin-left: auto; }
.m-add-card:active { transform: scale(.985); }

/* ---------- 订单：按尺码拆分 ---------- */
.sizes { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 13px; }
.sizes-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 11px; }
.sizes-head > span:first-child { font-size: 12.5px; font-weight: 600; }
.sizes-tip { font-size: 11px; color: var(--muted); }
.tiers {
  display: flex; gap: 9px; align-items: flex-end; flex-wrap: wrap;
  background: #fafbfc; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 11px;
}
.tiers label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: var(--muted); }
.tiers input {
  width: 92px; padding: 6px 9px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; outline: none;
}
.tiers input:focus { border-color: var(--brand); }
.size-rows { display: flex; flex-direction: column; gap: 7px; }
.size-row { display: grid; grid-template-columns: 92px 1fr 1fr 32px; gap: 8px; align-items: center; }
.size-row select, .size-row input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  width: 100%; outline: none; background: #fff;
}
.size-row select:focus, .size-row input:focus { border-color: var(--brand); }
.size-del {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 15px; height: 32px; border-radius: 7px; padding: 0;
}
.size-del:hover { background: var(--red-soft); color: var(--red); }
.sizes-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.size-sum { font-size: 12px; color: var(--ink-2); }
.size-sum b { color: var(--brand); font-variant-numeric: tabular-nums; }
.field input.derived { background: #f3f5f9; color: var(--brand); font-weight: 700; }

@media (max-width: 820px) {
  .size-row { grid-template-columns: 72px 1fr 1fr 30px; gap: 6px; }
  .tiers { gap: 7px; }
  .tiers input { width: 78px; }
  .tiers label { font-size: 10px; }
  .sizes-tip { display: none; }
}

/* ---------- 嵌入模式（被订单系统 iframe 嵌入时） ---------- */
body.embed .topbar { display: none; }
body.embed .content { padding-top: 12px; }
body.embed .sidebar { box-shadow: none; }
