/* ==========================================================
   赛事数据研究系统 · 界面样式
   设计语言：中性灰阶 + 单一主色，细边框、小圆角、高信息密度
   无 emoji、无渐变、不使用大阴影
   ========================================================== */
:root {
  --brand: #0052d9;
  --brand-hover: #003cab;
  --brand-weak: #e8f0ff;
  --text-1: rgba(0, 0, 0, 0.9);
  --text-2: rgba(0, 0, 0, 0.6);
  --text-3: rgba(0, 0, 0, 0.4);
  --line: #e5e6eb;
  --line-strong: #dcdfe6;
  --bg-page: #f5f6f7;
  --bg-card: #ffffff;
  --bg-weak: #f7f8fa;
  --success: #00a870;
  --warning: #ff8800;
  --danger: #d54941;
  --radius: 6px;
  --radius-sm: 4px;
  --home-color: #0052d9;
  --draw-color: #86909c;
  --away-color: #00a870;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5715;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

.is-hidden { display: none !important; }
.text-muted { color: var(--text-3); }

/* ==========================================================
   前台 H5
   ========================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
}
.app-header__inner {
  max-width: 900px;
  margin: 0 auto;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header__title { font-size: 16px; font-weight: 600; letter-spacing: .2px; }
.app-header__link { font-size: 13px; color: var(--text-2); }
.app-header__link:hover { color: var(--brand); }

.status-bar {
  max-width: 900px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.status-bar__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3); display: inline-block;
}
.status-bar__dot.is-ok { background: var(--success); }
.status-bar__dot.is-off { background: var(--warning); }

.tabs {
  position: sticky;
  top: 52px;
  z-index: 15;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  display: flex;
  overflow-x: auto;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-align: center;
}
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }

.container { max-width: 900px; margin: 0 auto; padding: 12px 12px 32px; }

.panel { margin-bottom: 12px; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 8px;
}
.panel__title { margin: 0; font-size: 15px; font-weight: 600; }
.panel__sub { font-size: 12px; color: var(--text-3); }

.card, .block {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.block__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.block__title { margin: 0; font-size: 14px; font-weight: 600; }
.block__sub { font-size: 12px; color: var(--text-3); }
.block > .input { margin: 14px; width: calc(100% - 28px); }
.result-box { padding: 14px; }
.result-box:empty { display: none; }

/* 比赛卡片 */
.match-list { display: flex; flex-direction: column; gap: 12px; }
.match {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.match__top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.match__code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-weak);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
}
.match__league { font-size: 12px; color: var(--text-3); }
.match__time { margin-left: auto; font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.match__teams { font-size: 15px; font-weight: 600; margin: 6px 0 2px; }
.match__verdict { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }

.prob-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.prob-row__label { width: 40px; font-size: 12px; color: var(--text-2); flex: none; }
.prob-row__bar { flex: 1; height: 6px; background: var(--bg-weak); border-radius: 3px; overflow: hidden; }
.prob-row__fill { height: 100%; border-radius: 3px; }
.prob-row__fill--home { background: var(--home-color); }
.prob-row__fill--draw { background: var(--draw-color); }
.prob-row__fill--away { background: var(--away-color); }
.prob-row__val { width: 48px; text-align: right; font-size: 12px; font-family: var(--mono); flex: none; }

.kv-row {
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--text-2);
}
.kv-row b { font-weight: 600; color: var(--text-1); font-family: var(--mono); }

/* 半全场网格 */
.hf-grid { margin-top: 10px; }
.hf-grid__title { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.hf-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.hf-table th, .hf-table td {
  border: 1px solid var(--line);
  padding: 4px 2px;
  text-align: center;
  font-family: var(--mono);
}
.hf-table th { background: var(--bg-weak); color: var(--text-2); font-weight: 500; }
.hf-table td.is-top { background: var(--brand-weak); color: var(--brand); font-weight: 600; }

/* 分析原因 */
.reason-list { margin: 10px 0 0; padding: 0; list-style: none; }
.reason-list li {
  font-size: 12px; color: var(--text-2); line-height: 1.6;
  padding: 3px 0 3px 10px; position: relative;
}
.reason-list li::before {
  content: ""; position: absolute; left: 0; top: 11px;
  width: 3px; height: 3px; border-radius: 50%; background: var(--text-3);
}

/* 指标 */
.metric-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px;
}
.metric {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.metric__label { font-size: 12px; color: var(--text-3); }
.metric__value { font-size: 18px; font-weight: 600; font-family: var(--mono); margin-top: 2px; }
.metric__sub { font-size: 11px; color: var(--text-3); }

/* 频次条 */
.freq-list { padding: 12px 14px; }
.freq-wrap + .freq-wrap { margin-top: 12px; }
.freq-wrap__title { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.freq-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.freq-cell { text-align: center; }
.freq-cell__num {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  background: var(--bg-weak); border-radius: var(--radius-sm); padding: 3px 0;
}
.freq-cell__num.is-hot { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
.freq-cell__bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 3px; }
.freq-cell__fill { height: 100%; background: var(--brand); border-radius: 2px; }

/* 号码球 */
.combo-list { padding: 12px 14px; }
.combo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.combo:last-child { border-bottom: none; }
.combo__no { font-size: 12px; color: var(--text-3); width: 32px; flex: none; }
.balls { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.ball {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-family: var(--mono); font-weight: 600;
  border: 1px solid transparent;
}
.ball--red { background: #fdeaea; color: #d54941; border-color: #f7c9c9; }
.ball--blue { background: #e8f0ff; color: #0052d9; border-color: #c3d4f7; }
.combo__meta { font-size: 12px; color: var(--text-3); width: 100%; padding-left: 42px; }

.note {
  margin: 0; padding: 12px 14px;
  font-size: 12px; color: var(--text-2); line-height: 1.7;
  background: var(--bg-weak); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* 条形列表 */
.bar-list { padding: 12px 14px; }
.bar-item { margin-bottom: 10px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-item__head {
  display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px;
}
.bar-item__name { color: var(--text-1); }
.bar-item__val { color: var(--text-2); font-family: var(--mono); }
.bar-item__track { height: 6px; background: var(--bg-weak); border-radius: 3px; overflow: hidden; }
.bar-item__fill { height: 100%; background: var(--brand); border-radius: 3px; }

/* 分段控件 */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg__item {
  border: none; background: #fff; padding: 5px 12px; font-size: 12px;
  color: var(--text-2); cursor: pointer; border-right: 1px solid var(--line);
  font-family: inherit;
}
.seg__item:last-child { border-right: none; }
.seg__item.is-active { background: var(--brand-weak); color: var(--brand); font-weight: 500; }
.seg--sm .seg__item { padding: 4px 10px; font-size: 12px; }

/* 表 */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line);
}
.table th { color: var(--text-2); font-weight: 500; background: var(--bg-weak); }
.table td { color: var(--text-1); }
.table tr:last-child td { border-bottom: none; }
.cell-key { width: 160px; color: var(--text-2); }
.cell-code { font-family: var(--mono); color: var(--brand); }
.cell-score { font-family: var(--mono); }

.skeleton {
  height: 120px; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: var(--radius);
}

.app-footer { padding: 16px 4px 0; }
.app-footer p { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.7; }

/* ==========================================================
   管理后台
   ========================================================== */
.admin-body { background: var(--bg-page); }

.admin-header {
  height: 56px; background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.admin-header__left { display: flex; align-items: center; gap: 10px; }
.admin-logo {
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  background: var(--brand); display: inline-block;
}
.admin-header__title { font-size: 16px; font-weight: 600; }
.admin-header__tag { font-size: 12px; color: var(--text-3); padding-left: 8px; border-left: 1px solid var(--line); }

.admin-shell { display: flex; align-items: flex-start; min-height: calc(100vh - 56px); }

.admin-sider {
  width: 200px; flex: none; background: var(--bg-card);
  border-right: 1px solid var(--line); min-height: calc(100vh - 56px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.admin-nav { padding: 12px 8px; }
.admin-nav__item {
  display: block; padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm); color: var(--text-1); font-size: 14px;
}
.admin-nav__item:hover { background: var(--bg-weak); }
.admin-nav__item.is-active { background: var(--brand-weak); color: var(--brand); font-weight: 500; }
.admin-sider__foot { padding: 16px; border-top: 1px solid var(--line); }
.admin-sider__ver { font-size: 12px; color: var(--text-2); font-family: var(--mono); }
.admin-sider__note { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.admin-main { flex: 1; padding: 20px 24px 40px; min-width: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 600; }
.page-head__actions { display: flex; gap: 8px; }

.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.kpi__label { font-size: 12px; color: var(--text-3); }
.kpi__value { font-size: 24px; font-weight: 600; font-family: var(--mono); margin-top: 4px; }

.card__head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card__title { margin: 0; font-size: 14px; font-weight: 600; }
.card__body { padding: 8px 0; }
.card__body > p { padding: 8px 16px; margin: 0; }
.card__body .table th, .card__body .table td { padding-left: 16px; padding-right: 16px; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 12px; color: var(--text-2); }
.field__hint { font-size: 12px; color: var(--text-3); }
.field__hint code {
  font-family: var(--mono); background: var(--bg-weak);
  padding: 1px 4px; border-radius: 3px;
}
.input {
  width: 100%; padding: 7px 10px; font-size: 13px; font-family: inherit;
  color: var(--text-1); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  outline: none;
}
.input:focus { border-color: var(--brand); }
.input--mono { font-family: var(--mono); font-size: 12px; }

.form-actions { padding: 0 16px 16px; display: flex; align-items: center; gap: 12px; }
.form-msg { font-size: 12px; }
.form-msg.is-ok { color: var(--success); }
.form-msg.is-err { color: var(--danger); }

/* 按钮 */
.btn {
  padding: 6px 14px; font-size: 13px; font-family: inherit;
  color: var(--text-1); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 4px 10px; font-size: 12px; }

/* 数据源卡片 */
.source-list { display: flex; flex-direction: column; gap: 12px; }
.source-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); }
.source-card__head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.source-card__title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.source-card__desc { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.source-card__body { padding: 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.source-card__body .field--full { grid-column: 1 / -1; }
.source-card__foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.source-card__status { display: flex; align-items: center; gap: 12px; }
.source-card__msg { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.source-card__actions { display: flex; align-items: center; gap: 8px; }
.link { font-size: 12px; }

.badge {
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
  background: var(--bg-weak); color: var(--text-2); font-weight: 400;
}
.badge--brand { background: var(--brand-weak); color: var(--brand); }

.switch {
  font-size: 12px; padding: 3px 10px; border-radius: 3px; cursor: pointer;
  background: var(--bg-weak); color: var(--text-3); border: 1px solid var(--line);
  user-select: none;
}
.switch.is-on { background: var(--brand-weak); color: var(--brand); border-color: #c3d4f7; }

.notice {
  background: var(--bg-card); border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px;
  font-size: 12px; color: var(--text-2); line-height: 1.7;
}

.code-block {
  margin: 0; padding: 14px 16px; background: var(--bg-weak);
  font-family: var(--mono); font-size: 12px; line-height: 1.8;
  color: var(--text-1); white-space: pre-wrap; word-break: break-all;
}

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, .85); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: var(--radius-sm); opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================
   响应式
   ========================================================== */
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .form-grid, .source-card__body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-sider { width: 64px; }
  .admin-nav__item { text-align: center; padding: 9px 4px; font-size: 12px; }
  .admin-sider__foot { display: none; }
  .admin-main { padding: 16px 12px 32px; }
  .admin-header { padding: 0 12px; }
  .admin-header__tag { display: none; }
}
@media (max-width: 480px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .freq-grid { grid-template-columns: repeat(6, 1fr); }
  .cell-key { width: 110px; }
}
