* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; color: #303133; background: #f2f3f5; }
.hidden { display: none !important; }
.grow { flex: 1; }
.muted { color: #909399; }
.small { font-size: 12px; }
.err, .bad { color: #f56c6c; }
.up { color: #67c23a; }
.down { color: #f56c6c; }
.offscreen { position: fixed; left: -9999px; top: 0; }

button { font: inherit; padding: 5px 12px; border: 1px solid #dcdfe6; border-radius: 4px; background: #fff; color: #606266; cursor: pointer; white-space: nowrap; }
button:hover { border-color: #c6e2ff; color: #409eff; }
button:disabled { opacity: .6; cursor: default; }
button.primary { background: #409eff; border-color: #409eff; color: #fff; }
button.primary:hover { background: #66b1ff; border-color: #66b1ff; color: #fff; }
button.ghost { border-color: transparent; background: transparent; color: #909399; }
button.ghost:hover { color: #f56c6c; }
button.link { border: 0; background: none; color: #409eff; padding: 2px 4px; }
button.small { padding: 1px 6px; font-size: 12px; }
input, select, textarea { font: inherit; color: inherit; border: 1px solid #dcdfe6; border-radius: 4px; padding: 4px 8px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #409eff; }

/* 登录 */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 300px; background: #fff; padding: 28px 24px; border-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.login-box input { padding: 8px 10px; }
.login-box button { padding: 8px; }
.login-box .err { margin: 0; min-height: 21px; }

/* 顶栏 */
.top { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #fff; border-bottom: 1px solid #e4e7ed; position: sticky; top: 0; z-index: 5; }
.brand { font-size: 16px; margin-right: 8px; }
#sheetSel { max-width: 260px; }

/* 账单设置 */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e4e7ed; }
.bar label { display: inline-flex; align-items: center; gap: 6px; color: #606266; }
#sName { width: 130px; }
#sContact { max-width: 180px; }
.num4 { width: 64px; }
.draw { width: 64px; font-size: 16px; letter-spacing: 3px; text-align: center; font-weight: 600; }
#oddsBox summary { cursor: pointer; color: #409eff; }
.odds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; padding: 10px 0 4px; }
.odds-grid label { justify-content: space-between; font-size: 13px; }
.odds-grid input { width: 80px; }
#oddsBox[open] { flex-basis: 100%; }

/* 主体 */
/* 电脑：左边粘贴框+单子，右边汇总一直停在上面；手机：粘贴框 → 汇总 → 单子 */
.body { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "paste sum" "list sum"; grid-template-rows: auto 1fr; gap: 0 16px; padding: 16px; }
.paste { grid-area: paste; }
.list { grid-area: list; min-width: 0; }
.right { grid-area: sum; align-self: start; position: sticky; top: 62px; background: #fff; border-radius: 6px; padding: 14px; max-height: calc(100vh - 80px); overflow: auto; }

.paste { background: #fff; border-radius: 6px; padding: 12px; }
.paste textarea { width: 100%; min-height: 120px; resize: vertical; line-height: 1.6; }
.paste-ops { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.radio { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.paste-ops .primary { padding: 6px 24px; }

.tabs { display: flex; align-items: center; gap: 6px; margin: 14px 0 8px; }
.tab { border-radius: 14px; padding: 2px 12px; }
.tab.on { background: #409eff; border-color: #409eff; color: #fff; }
.tab.warn:not(.on) { color: #e6a23c; border-color: #f5dab1; }
.empty { text-align: center; padding: 20px; }

/* 单 */
.card { background: #fff; border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid #dcdfe6; }
.card.st-auto { border-left-color: #c0c4cc; }
.card.st-ok { border-left-color: #67c23a; }
.card.st-check { border-left-color: #e6a23c; background: #fffaf2; }
.card.st-nonbet { opacity: .7; }
.card.editing { border-left-color: #409eff; box-shadow: 0 0 0 1px #c6e2ff; }
.card.flash { box-shadow: 0 0 0 2px #409eff; }
.card-h { display: flex; align-items: center; gap: 8px; }
.no { color: #909399; font-size: 12px; min-width: 26px; }
.tag { font-size: 12px; padding: 0 6px; border-radius: 3px; line-height: 20px; }
.t-auto { background: #f4f4f5; color: #909399; }
.t-ok { background: #f0f9eb; color: #67c23a; }
.t-check { background: #fdf6ec; color: #e6a23c; }
.t-non { background: #f4f4f5; color: #909399; }
.t-edit { background: #ecf5ff; color: #409eff; }
.total { font-size: 16px; font-weight: 600; }
.src { margin: 6px 0; padding: 6px 8px; background: #f7f8fa; border-radius: 4px; white-space: pre-wrap; word-break: break-all; font: inherit; color: #303133; max-height: 220px; overflow: auto; }
.items { display: flex; flex-direction: column; gap: 2px; }
.it { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cat { font-size: 12px; padding: 0 4px; border-radius: 3px; color: #fff; }
.cat.F { background: #e6553a; }
.cat.T { background: #2f7fd1; }
.gt { color: #606266; }
.n { font-weight: 600; letter-spacing: 1px; }
.n.hitn { color: #f56c6c; text-decoration: underline; }
.amt-s { color: #303133; }
.hit { color: #f56c6c; font-weight: 600; }
.why { margin-top: 6px; font-size: 13px; color: #909399; }
.why.bad { color: #e6a23c; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ops button { padding: 3px 10px; }

table.edit { width: 100%; border-collapse: collapse; margin-top: 6px; }
table.edit th { text-align: left; font-weight: normal; color: #909399; font-size: 12px; padding: 2px 4px; }
table.edit td { padding: 3px 4px; }
table.edit select, table.edit input { width: 100%; }
table.edit td:nth-child(1) { width: 76px; }
table.edit td:nth-child(2) { width: 170px; }
table.edit td:nth-child(4) { width: 100px; }
table.edit td:nth-child(5) { width: 30px; }
.edit-sum { margin-top: 6px; }
#editErr { min-height: 0; margin-top: 4px; }

/* 汇总 */
.warn-line { width: 100%; text-align: left; background: #fdf6ec; border-color: #f5dab1; color: #e6a23c; margin-bottom: 10px; }
.warn-line:hover { color: #e6a23c; border-color: #e6a23c; }
table.sum { width: 100%; border-collapse: collapse; }
table.sum th { font-weight: normal; color: #909399; font-size: 12px; text-align: right; padding: 4px 6px; border-bottom: 1px solid #ebeef5; }
table.sum th:first-child { text-align: left; }
table.sum td { text-align: right; padding: 5px 6px; border-bottom: 1px solid #f2f3f5; }
table.sum td:first-child { text-align: left; color: #606266; white-space: nowrap; }
table.sum tr.profit td { font-size: 16px; font-weight: 600; border-bottom: 0; }
.draw-n { font-weight: 600; letter-spacing: 2px; }
table.sum.gt td:first-child { white-space: normal; }
.settle-line { margin: 10px 0; font-size: 15px; }
.settle-line b { font-size: 18px; }
.btns { display: flex; gap: 8px; }
.btns button { flex: 1; padding: 7px; }
.right h4 { margin: 16px 0 6px; font-size: 13px; color: #909399; font-weight: normal; }
.hits { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.hits li { padding: 3px 0; border-bottom: 1px dashed #ebeef5; }
.hits a { color: #409eff; text-decoration: none; }
.preview { margin-top: 14px; }
.preview summary { cursor: pointer; color: #409eff; font-size: 13px; }
.preview pre { white-space: pre-wrap; background: #f7f8fa; padding: 8px; border-radius: 4px; font: 13px/1.6 inherit; font-family: inherit; user-select: text; }

.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); background: #303133; color: #fff; padding: 8px 18px; border-radius: 4px; z-index: 20; max-width: 90vw; }
.toast.bad { background: #f56c6c; }

@media (max-width: 860px) {
  .body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "paste" "sum" "list"; grid-template-rows: auto; gap: 10px; padding: 10px; }
  .right { position: static; max-height: none; }
  .tabs { margin-top: 4px; }
  .top { flex-wrap: wrap; padding: 8px 10px; }
  .bar { padding: 8px 10px; }
  #sheetSel { max-width: 50vw; }
  table.edit td:nth-child(2) { width: auto; }
}
