:root {
  color: #17202b;
  background: #fff;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
  --line: #d9d9d9;
  --muted: #7a7f86;
  --blue: #1677d2;
  --red: #ed303b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: #fff; }
body { padding-bottom: 68px; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #6eaee4; outline-offset: 2px; }

.app-header { background: #f1f1f1; border-bottom: 1px solid #e5e5e5; color: #101116; }
.header-inner { width: min(820px, 100%); min-height: 72px; margin: 0 auto; padding: 8px 18px 7px; display: flex; align-items: center; justify-content: space-between; }
.header-title { flex: 1; text-align: center; }
h1, h2, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.15; font-weight: 800; }
.host-label { margin-top: 3px; color: #81838a; font-size: 15px; line-height: 1.1; }
.session-actions { display: flex; align-items: center; gap: 8px; color: #555; font-size: 13px; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #30343a; }
.icon-button:hover { background: #e5e5e5; }
.icon-button:disabled { cursor: wait; opacity: .5; }
.icon-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

main { width: min(820px, 100%); margin: 0 auto; padding: 28px 14px 18px; }
.login-view { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 18px 0; }
.login-panel { width: min(390px, 100%); padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .08); }
.login-heading { margin-bottom: 22px; text-align: center; }
.login-mark { display: none; }
.login-heading h2 { font-size: 21px; font-weight: 800; }
.login-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.login-panel label { display: block; margin: 15px 0 6px; color: #555; font-size: 13px; font-weight: 700; }
.login-panel input, .base-control select { border: 1px solid #c9cdd2; border-radius: 5px; background: #fff; color: #17202b; }
.login-panel input { width: 100%; height: 40px; padding: 0 10px; }
.login-panel input:focus, .base-control select:focus { border-color: #6eaee4; outline: 0; box-shadow: 0 0 0 3px rgba(110, 174, 228, .14); }
.primary-button { width: 100%; min-height: 40px; margin-top: 10px; border: 1px solid var(--blue); border-radius: 5px; background: var(--blue); color: #fff; font-weight: 800; }
.primary-button:hover { background: #0d66bb; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.error-message { min-height: 20px; margin-top: 9px; color: var(--red); font-size: 13px; }

.dashboard { padding: 0; }
.dashboard-toolbar { min-height: 34px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-bottom: 8px; }
.reference-mode .dashboard-toolbar { display: none; }
.reference-mode .session-actions { display: none; }
.base-control { display: flex; align-items: center; gap: 6px; color: #73777d; font-size: 12px; }
.base-control select { height: 30px; padding: 0 21px 0 7px; font-size: 12px; }
.dashboard-toolbar .subtle { margin: 0 auto 0 0; color: #92969b; font-size: 11px; }

.summary-board { width: 100%; border: 1px solid var(--line); background: #fff; }
.summary-row { display: grid; grid-template-columns: 1fr 1fr; min-height: 69px; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row > div { display: flex; align-items: center; justify-content: center; padding: 7px 10px; border-right: 1px solid var(--line); }
.summary-row > div:last-child { border-right: 0; }
.summary-key { color: #101722; font-size: 29px; font-weight: 800; }
.summary-total-label { font-size: 25px; }
.summary-number { color: #111923; font-size: 29px; font-weight: 800; }
.summary-number.positive, .value.positive { color: var(--blue); }
.summary-number.negative, .value.negative { color: var(--red); }

.reports { width: 100%; margin-top: 0; border: 1px solid var(--line); border-top: 0; background: #fff; overflow: hidden; }
.report-row { display: grid; border-bottom: 1px solid var(--line); }
.report-row:last-child { border-bottom: 0; }
.reference-reports { overflow-x: auto; }
/* v90 column order: 群号 | 输赢 | 合计 | 小费 | 落子 */
/* v92: 合计 column moved before 输赢; all four numeric columns share one width. */
.reference-header, .reference-row { min-width: 360px; grid-template-columns: .7fr 1fr 1fr 1fr 1fr; }
.reference-header { min-height: 52px; background: #fafafa; color: #555d66; font-size: 20px; font-weight: 800; }
.reference-row { min-height: 62px; }
.reference-row > div, .reference-header > div { display: flex; align-items: center; justify-content: center; padding: 6px 5px; border-right: 1px solid var(--line); text-align: center; overflow-wrap: anywhere; }
.reference-row > div:last-child, .reference-header > div:last-child { border-right: 0; }
.reference-row > div { color: #111923; font-size: 22px; font-weight: 800; }
.reference-row > div:first-child { color: #4f5862; }
.reference-row .value { font-size: 22px; white-space: nowrap; }
.reference-mode .positive { color: #579fda; }
.reference-mode .negative { color: #e77480; }
.reference-row .value.positive { color: #579fda; }
.reference-row .value.negative { color: #e77480; }
.empty-state { padding: 42px 20px; border: 1px solid var(--line); color: #8b9096; text-align: center; }

.detail-summary { margin-bottom: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; }
.summary-item { min-width: 0; padding: 11px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.summary-item:nth-child(2n) { border-right: 0; }
.summary-label { display: block; color: var(--muted); font-size: 12px; }
.summary-value { display: block; margin-top: 4px; color: #1d2b39; font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.summary-value.positive, .detail-row .positive { color: var(--blue); }
.summary-value.negative, .detail-row .negative { color: var(--red); }
.detail-reports { border-top: 1px solid var(--line); overflow-x: auto; }
.detail-header, .detail-row { min-width: 900px; grid-template-columns: 100px repeat(6, minmax(68px, 1fr)) 88px 88px minmax(100px, 1fr); }
.detail-header { background: #fafafa; color: #555d66; font-size: 12px; font-weight: 800; }
.detail-row > div, .detail-header > div { padding: 8px; border-right: 1px solid var(--line); text-align: right; }
.detail-row > div:first-child, .detail-header > div:first-child { text-align: left; }

.switch-button { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; width: 100%; height: 58px; border: 0; border-radius: 0; background: #7fc3f2; color: #fff; font-size: 23px; font-weight: 700; }
.switch-button:hover { background: #68b3e8; }
[hidden] { display: none !important; }

@media (max-width: 520px) {
  main { padding: 20px 8px 14px; }
  .header-inner { min-height: 67px; padding-inline: 11px; }
  h1 { font-size: 24px; }
  .host-label { font-size: 14px; }
  .summary-row { min-height: 69px; }
  .summary-key, .summary-number { font-size: 28px; }
  .summary-total-label { font-size: 24px; }
  .reference-header { min-height: 50px; font-size: 17px; }
  .reference-row { min-height: 61px; }
  .reference-row > div, .reference-header > div { padding-inline: 1px; }
  .reference-row > div, .reference-row .value { font-size: 20px; }
}
