/* ============================================================
   IPLight B端后台 · 全局设计系统
   色板/尺寸/字体/交互 统一规范 · 亮暗双主题
   ============================================================ */
:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --success: #10B981;
  --warn: #F59E0B;
  --error: #EF4444;

  --radius: 8px;
  --card-pad: 20px;
  --card-gap: 16px;
  --module-gap: 20px;

  --font: "Inter", "Source Han Sans SC", "思源黑体", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
/* ---------- 亮色主题（默认） ---------- */
:root, [data-theme="light"] {
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --card-hover: #FFFFFF;
  --text: #1F2937;
  --text2: #94A3B8;
  --placeholder: #9CA3AF;
  --border: #E5E7EB;
  --input-bg: #FFFFFF;
  --thead-bg: #F3F4F6;
  --thead-bg-sticky: #EEF0F3;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, .10);
  /* 热力格（低饱和） */
  --cell-ok-bg: #D1FAE5;   --cell-ok-fg: #065F46;
  --cell-re-bg: #FEF3C7;   --cell-re-fg: #78350F;
  --cell-wrong-bg: #FEE2E2;--cell-wrong-fg: #7F1D1D;
  --cell-err-bg: #F3F4F6;  --cell-err-fg: #9CA3AF;
  --row-hover: rgba(37, 99, 235, .10);
  --col-hl: rgba(37, 99, 235, .18);
}
/* ---------- 暗色主题 ---------- */
[data-theme="dark"] {
  --bg: #0F172A;
  --card: #1E293B;
  --card-hover: #243147;
  --text: #F1F5F9;
  --text2: #94A3B8;
  --placeholder: #9CA3AF;
  --border: #334155;
  --input-bg: #172033;
  --thead-bg: #172033;
  --thead-bg-sticky: #131C2E;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, .4);
  --cell-ok-bg: #065F46;   --cell-ok-fg: #D1FAE5;
  --cell-re-bg: #78350F;   --cell-re-fg: #FDE68A;
  --cell-wrong-bg: #7F1D1D;--cell-wrong-fg: #FECACA;
  --cell-err-bg: #263248;  --cell-err-fg: #64748B;
  --row-hover: rgba(37, 99, 235, .14);
  --col-hl: rgba(37, 99, 235, .22);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-hover); }
.num { font-weight: 700; font-variant-numeric: tabular-nums; }
.muted { color: var(--text2); font-weight: 300; }

/* ============ 通用卡片 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--card-pad);
  box-shadow: var(--shadow);
  transition: background .2s, transform .2s, box-shadow .2s;
}
.card.hoverable:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* ============ 右上角 语言/主题切换 ============ */
.top-bar {
  position: fixed; top: 16px; right: 20px; z-index: 50;
  display: flex; align-items: center; gap: 10px;
}
.seg {
  display: flex; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.seg button {
  border: 0; background: transparent; color: var(--text2);
  font: 600 12px/1 var(--font); padding: 7px 10px; cursor: pointer;
  transition: color .15s, background .15s;
}
.seg button.on { color: var(--primary); background: rgba(37, 99, 235, .10); }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); cursor: pointer;
  font-size: 15px; line-height: 1; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ============ 表单 ============ */
.field { margin-bottom: var(--module-gap); }        /* 表单项之间 20px */
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; margin-bottom: 8px;                 /* 标签-输入框 8px */
  font-weight: 500; color: var(--text); font-size: 13px;
}
.field .req { color: var(--primary); margin-right: 4px; font-weight: 700; }
.input-wrap { position: relative; }
.input-wrap .eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  color: var(--placeholder); font-size: 15px; padding: 4px;
}
.input-wrap .eye:hover { color: var(--text2); }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--input-bg); color: var(--text);
  font: 400 14px var(--font); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--placeholder); }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
input.err-state { border-color: var(--error); }
.err-msg { display: none; margin-top: 6px; font-size: 12px; color: var(--error); }
.err-msg.show { display: block; }

/* ============ 按钮 ============ */
.btn-primary {
  height: 40px; padding: 0 44px;                       /* 不铺满 */
  border: 0; border-radius: var(--radius); cursor: pointer;
  background: var(--primary); color: #fff;
  font: 600 14px var(--font); transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost {
  height: 32px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card); color: var(--text2);
  font: 500 12px var(--font); cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { color: var(--primary); border-color: var(--primary); }

/* ============ 滑块验证码 ============ */
.slider-captcha { height: 40px; }
.slider-track {
  position: relative; height: 40px; border-radius: var(--radius);
  background: var(--input-bg); border: 1px solid var(--border); overflow: hidden;
}
.slider-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: rgba(16, 185, 129, .18);
}
.slider-tip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--placeholder); font-size: 13px; user-select: none;
  transition: opacity .2s;
}
.slider-handle {
  position: absolute; left: 0; top: 0; width: 44px; height: 100%;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text2); cursor: grab; user-select: none; touch-action: none;
  border-radius: var(--radius) 0 0 var(--radius); transition: background .15s;
}
.slider-handle:hover { color: var(--primary); }
.slider-track.ok { border-color: var(--success); }
.slider-track.ok .slider-fill { width: 100% !important; background: rgba(16, 185, 129, .18); }
.slider-track.ok .slider-tip { opacity: 1; color: var(--success); font-weight: 500; }
.slider-track.ok .slider-handle { left: calc(100% - 44px) !important; color: var(--success); }

/* ============ 复选框 ============ */
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ============ Tab ============ */
.tabs { display: flex; gap: 32px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs a {
  padding: 0 2px 10px; font-size: 15px; color: var(--text2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s;
}
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { color: var(--primary); }

/* ============ 报表页 ============ */
.rep-wrap { max-width: 1440px; margin: 0 auto; padding: 72px 24px 48px; }
.rep-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.rep-head h1 { font-size: 22px; font-weight: 600; }
.rep-head .sub { margin-top: 6px; font-size: 13px; color: var(--text2); font-weight: 300; }
.rep-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.date-chip {
  padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); font-weight: 600; font-size: 13px;
}
.geofeed-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; font-size: 13px; }
.geofeed-link .ext { font-size: 11px; }

/* --- 汇总卡片 --- */
#cards { display: grid; gap: var(--card-gap); margin-bottom: 32px; }
@media (min-width: 1280px) { #cards { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1024px) and (max-width: 1279px) { #cards { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) and (max-width: 1023px) { #cards { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 480px) and (max-width: 767px) { #cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479px) { #cards { grid-template-columns: 1fr; } }
.stat-card { cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.sc-row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-name { font-weight: 600; font-size: 14px; }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text2); white-space: nowrap; }
.st i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.st-red i { background: var(--error); }
.st-yellow i { background: var(--warn); }
.st-blue i { background: var(--primary); }
.st-green i { background: var(--success); }
.sc-big { font-size: 26px; line-height: 1; }
.sc-row2 .muted { font-size: 12px; margin-left: 4px; }
.sc-bar { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
[data-theme="dark"] .sc-bar { background: #0F172A; }
.sc-bar-fill { height: 100%; border-radius: 4px; opacity: .75; transition: width .4s; }
.sc-note { font-size: 11px; line-height: 1.45; font-weight: 300; }

/* --- 矩阵 --- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-size: 16px; font-weight: 600; }
.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text2); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dot-ok { background: var(--cell-ok-bg); border: 1px solid var(--cell-ok-fg); }
.dot-re { background: var(--cell-re-bg); border: 1px solid var(--cell-re-fg); }
.dot-wrong { background: var(--cell-wrong-bg); border: 1px solid var(--cell-wrong-fg); }
.dot-err { background: var(--cell-err-bg); border: 1px solid var(--border); }
.matrix-wrap { overflow: auto; max-height: 70vh; border-radius: var(--radius); }
table.matrix { border-collapse: separate; border-spacing: 0; min-width: 1150px; width: 100%; font-size: 12px; }
table.matrix th, table.matrix td { padding: 0; }
table.matrix thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--thead-bg); color: var(--text2);
  font-weight: 600; font-size: 12px; text-align: center;
  padding: 10px 6px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.matrix thead th:first-child { text-align: left; padding-left: 14px; }
table.matrix thead th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
table.matrix thead th.sortable:hover { color: var(--primary); }
table.matrix thead th.sorted { color: var(--primary); }
table.matrix thead th.sorted::after { content: " ▾"; font-size: 10px; }
table.matrix thead th.sorted.asc::after { content: " ▴"; }
table.matrix tbody td { text-align: center; height: 34px; border-bottom: 1px solid var(--border); }
table.matrix td.stick-col, table.matrix th.stick-col {
  position: sticky; left: 0; z-index: 2; background: var(--card);
  text-align: left; padding: 0 14px; white-space: nowrap; font-size: 12px; min-width: 138px;
  border-right: 1px solid var(--border);
}
table.matrix thead th.stick-col { z-index: 4; background: var(--thead-bg-sticky); }
table.matrix td.exp, table.matrix th.exp {
  color: var(--text2); font-weight: 300; white-space: nowrap;
  padding: 0 14px; min-width: 130px; text-align: left;
  background: color-mix(in srgb, var(--card) 55%, transparent);
}
table.matrix thead th.exp { background: var(--thead-bg); }
td.c-exact { background: var(--cell-ok-bg); color: var(--cell-ok-fg); font-weight: 700; }
td.c-region { background: var(--cell-re-bg); color: var(--cell-re-fg); font-weight: 700; }
td.c-wrong { background: var(--cell-wrong-bg); color: var(--cell-wrong-fg); font-weight: 700; }
td.c-err { background: var(--cell-err-bg); color: var(--cell-err-fg); }
table.matrix tbody tr { transition: none; }
table.matrix tbody tr:hover td { background-image: linear-gradient(var(--row-hover), var(--row-hover)); }
table.matrix td.hl-col, table.matrix th.hl-col {
  background-image: linear-gradient(var(--col-hl), var(--col-hl)) !important;
  box-shadow: inset 0 0 0 1px var(--primary);
}
@media (max-width: 767px) {
  .rep-wrap { padding: 76px 14px 40px; }
  .rep-head h1 { font-size: 18px; }
  .sc-big { font-size: 22px; }
}
