:root {
  --bg: #f5f6f8; --panel: #fff; --line: #e3e6ea;
  --tx: #1c2430; --tx2: #6b7684;
  --pri: #1a66cc; --pri-weak: #e8f0fc;
  --red: #d4380d; --green: #1a7f37; --amber: #b25e09;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--tx);
  font: 15px/1.6 "Microsoft YaHei", "PingFang SC", sans-serif; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 0 20px;
  height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; font-size: 16px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px;
  border-radius: 6px; color: var(--tx2); text-decoration: none; white-space: nowrap; }
.topbar nav a.on, .topbar nav a:hover { background: var(--pri-weak); color: var(--pri); }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
/* 大屏（16:9 及以上）放宽内容区，减少两侧空白浪费 */
@media (min-width: 1440px) {
  main { max-width: min(1720px, 94vw); padding: 24px 24px 60px; }
}

.hero h1 { margin: 12px 0 4px; font-size: 24px; }
.hero p { margin: 0 0 20px; color: var(--tx2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px; text-decoration: none; color: var(--tx); transition: .15s; }
.card:hover { border-color: var(--pri); box-shadow: 0 2px 10px rgba(26,102,204,.08); }
.card.disabled { opacity: .5; pointer-events: none; }
.card-num { font-size: 20px; color: var(--pri); }
.card-name { font-weight: 700; margin: 6px 0 4px; }
.card-desc { color: var(--tx2); font-size: 13px; }

h2 { font-size: 20px; margin: 8px 0 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 10px; font-size: 16px; }
.hint { color: var(--tx2); font-size: 13px; margin: 0 0 10px; }
.hidden { display: none !important; }
.msg { margin-left: 10px; color: var(--tx2); font-size: 13px; }

button, input[type=file] { font: inherit; }
button { padding: 7px 16px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; }
button.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
button:hover { filter: brightness(.97); }
.actions { margin-top: 12px; display: flex; gap: 10px; }

.pill { display: inline-block; padding: 1px 10px; border-radius: 999px;
  background: var(--pri-weak); color: var(--pri); font-size: 13px; }
.pill.green { background: #e6f4ea; color: var(--green); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button { padding: 5px 14px; border-radius: 999px; font-size: 14px; }
.tabs button.on { background: var(--pri-weak); border-color: var(--pri); color: var(--pri); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { background: #fafbfc; color: var(--tx2); font-weight: 600; position: sticky; top: 0; }
td.empty { color: var(--tx2); text-align: center; padding: 18px; white-space: normal; }
.row-added td:first-child { color: var(--green); }
.row-updated td:first-child { color: var(--amber); }
.row-removed td:first-child { color: var(--red); }
.row-dropped td:first-child { color: var(--tx2); }
tr:last-child td { border-bottom: none; }
a { color: var(--pri); }

/* 手机适配 */
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar .brand { font-size: 13px; white-space: nowrap; }
  .topbar nav a { padding: 6px 8px; font-size: 14px; }
  .topbar nav a span { display: none; }   /* 手机端仅显图标 */
  .topbar nav a { font-size: 17px; }
  main { padding: 12px 5px 40px; }          /* 压缩屏幕边缘留白，表格多显示内容 */
  .panel { padding: 8px 6px; margin-bottom: 10px; border-radius: 8px; }
  table { font-size: 12.5px; }
  th, td { padding: 6px 8px; }
}

/* ---- 研判页 ---- */
.input-row { display: flex; gap: 14px; margin-bottom: 12px; }
.input-row textarea { flex: 1; font: 13px/1.6 Consolas, monospace; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.kw-col { width: 260px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.kw-col.grow { flex: 1; width: auto; }
.kw-col input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.paste-box { margin-top: 10px; }
.paste-box summary { cursor: pointer; color: var(--tx2); font-size: 13px; }
.paste-box textarea { width: 100%; margin-top: 8px; }
.hint2 { color: var(--tx2); font-size: 12px; font-weight: 400; }
.panel.err { border-color: #f0c1b4; background: #fff5f2; }
.panel.warn-row { background: #fff8e8; border-color: #f0dcb4; color: #7a3d00; font-size: 13px; }
.row-err { color: var(--red); font-size: 13px; margin: 4px 0; }
.verdict { border-left: 4px solid var(--pri); }
.v-head { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.v-head .code { color: var(--tx2); font-size: 14px; font-weight: 400; }
.v-head .share { font-size: 13px; font-weight: 400; }
.pill.red { background: #fdeceb; color: var(--red); }
button.mini { padding: 3px 10px; font-size: 12.5px; border-radius: 999px; }
.v-band, .v-start, .v-users { margin-top: 8px; }
.v-users .red, .red { color: var(--red); }
.v-warn { margin-top: 8px; font-size: 13px; color: #7a3d00; background: #fff8e8;
  border-radius: 6px; padding: 6px 10px; }
.nc { font-size: 13.5px; color: var(--tx2); margin: 4px 0 8px; }
.pt-cut { color: var(--red); font-weight: 600; }
.pt-ok { color: var(--tx2); }
tr.row-cut td:first-child { color: var(--red); }
.cand { margin: 4px 8px 4px 0; }
.chart { width: 100%; }
.chart-polar svg { display: block; max-width: 640px; margin: 0 auto; }
/* 研判两图表：电脑端同行双列，手机端纵向 */
.charts-row .panel { margin-bottom: 16px; }
@media (min-width: 1024px) {
  .charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  .charts-row .chart-polar svg { max-width: 100%; }
}
.chart-profile { height: 430px; }
@media (max-width: 640px) {
  .input-row { flex-direction: column; }
  .kw-col { width: 100%; }
  .chart-polar { height: 420px; }
}

/* ---- OLT 下拉搜索 ---- */
.kw-col { position: relative; }
.dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.10); max-height: 320px; overflow-y: auto; }
.dd-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f2f4f7; }
.dd-item:hover { background: var(--pri-weak); }
.dd-item:last-child { border-bottom: none; }
.dd-item b { font-size: 14px; margin-right: 8px; }
.dd-code { color: var(--pri); font-size: 12.5px; margin-right: 8px; }
.dd-n { color: var(--tx2); font-size: 12px; }
.dd-name { color: var(--tx2); font-size: 12px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.dd-empty { padding: 12px; color: var(--tx2); font-size: 13px; text-align: center; }

/* ---- 最近研判历史 ---- */
.his-list { display: flex; flex-direction: column; }
.his-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px;
  text-decoration: none; color: var(--tx); flex-wrap: wrap; }
.his-item:hover { background: var(--pri-weak); border-color: var(--pri); }
.his-olt { font-weight: 600; font-size: 14px; }
.his-code { color: var(--pri); font-size: 12.5px; }
.his-p, .his-u { color: var(--tx2); font-size: 12.5px; }
.his-t { color: var(--tx2); font-size: 12px; margin-left: auto; }
/* 列表行：手机保持原单行；宽屏（≥1440）两行两列——行1 OLT｜断口，行2 时间｜光交 */
.hg-ports, .hg-boxes { display: none; }
.hg-time { margin-left: auto; }
.hg-olt { display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hs-lab { color: var(--tx2); flex-shrink: 0; }
.hs-val { color: var(--tx); }
.hs-port { font-family: Consolas, monospace; color: #b3300a; margin-right: 8px; }
@media (min-width: 1440px) {
  .his-item { display: grid; grid-template-columns: minmax(300px, auto) 1fr;
    gap: 6px 28px; align-items: baseline; }
  .hg-olt { flex-wrap: nowrap; }
  .hg-time { margin-left: 0; }
  .hg-ports, .hg-boxes { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; }
  .hg-time .his-t { margin-left: 0; }
}
.seg-date { padding: 5px 14px; border: 1px solid var(--line); background: #fff;
  border-radius: 16px; font-size: 12.5px; color: var(--tx2); cursor: pointer; }
.seg-date.on { background: var(--pri); color: #fff; border-color: var(--pri); }
.his-empty { color: var(--tx2); font-size: 13px; padding: 4px 0; }
/* 研判页顶部记录条（横向卡片） */
.his-item.cur { border-color: var(--pri); background: var(--pri-weak); }
.his-item { position: relative; padding-right: 44px; }
.his-x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 6px; border: none; background: #fdecea;
  color: #d4380d; font-size: 13px; cursor: pointer; }
.his-x:hover { background: #d4380d; color: #fff; }
@media (max-width: 640px) {
  .his-t { margin-left: 0; width: 100%; }
}

/* ---- 首页研判记录筛选 ---- */
.his-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.his-head h3 { margin: 0; }
.his-new { text-decoration: none; padding: 7px 14px; font-size: 13.5px; }
.his-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: flex; background: #eef1f5; border-radius: 999px; padding: 3px; }
.seg-btn { border: none; background: transparent; padding: 5px 14px; font-size: 13px;
  border-radius: 999px; cursor: pointer; color: var(--tx2); }
.seg-btn.active { background: var(--pri); color: #fff; font-weight: 600; }
.his-search { flex: 1; min-width: 160px; padding: 7px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; }
.his-mode { font-size: 12px; color: var(--tx2); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; }
.his-foot { color: var(--tx2); font-size: 12px; margin-top: 8px; }
@media (max-width: 640px) {
  .his-filter { flex-direction: column; align-items: stretch; }
  .seg { justify-content: center; }
}

/* ---- 记录左滑删除（手机滑动后露出；PC 右键菜单删除） ---- */
.his-wrap { position: relative; margin-bottom: 6px; border-radius: 8px; overflow: hidden; }
.his-del { position: absolute; right: 0; top: 0; bottom: 0; width: 72px;
  background: #d4380d; color: #fff; border: none; font-size: 14px;
  font-weight: 600; cursor: pointer; }
.his-item { position: relative; z-index: 1; margin-bottom: 0; border-radius: 8px;
  transition: transform .18s; will-change: transform; background: #fff; }

/* ---- PC 右键删除菜单 ---- */
#ctxMenu { position: fixed; z-index: 3000; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); padding: 4px; display: none; }
#ctxMenu.show { display: block; }
#ctxMenu button { display: block; width: 130px; text-align: left; border: none; background: none;
  padding: 8px 12px; font-size: 13.5px; border-radius: 6px; cursor: pointer; color: #d4380d; }
#ctxMenu button:hover { background: #fdeceb; }

/* ---- 断点定位图卡片 ---- */
.prof-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 12px;
  margin-bottom: 18px; background: #fff; }
.prof-title { text-align: center; font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.prof-sub { text-align: center; font-size: 12px; color: var(--tx2); margin-bottom: 10px; }
.prof-alert { border: 1.5px solid #d4380d; border-radius: 8px; background: #fff5f2;
  text-align: center; padding: 8px 10px; margin: 0 auto 10px; max-width: 460px;
  color: #a3300a; font-size: 14px; }
.prof-alert span { display: block; font-size: 11.5px; color: #c0662e; font-weight: 400; }
.prof-alert b { color: #d4380d; }
.prof-foot { border: 1px solid #b7d6b0; background: #f3faf1; border-radius: 8px;
  padding: 8px 12px; font-size: 12.5px; color: #2e7d32; max-width: 560px; margin: 10px auto 0; }
.prof-foot div + div { margin-top: 3px; }

/* ---- 地图光交搜索 ---- */
.lp-search-wrap { position: relative; }
.sr-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 1200;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 240px; overflow-y: auto; }
.sr-item { padding: 7px 10px; font-size: 12.5px; cursor: pointer;
  border-bottom: 1px solid #f2f4f7; line-height: 1.4; }
.sr-item:hover { background: var(--pri-weak, #eef4ff); }
.sr-item:last-child { border-bottom: none; }
.sr-none { color: var(--tx2); cursor: default; }
.sr-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle; }
.sr-dot.c { background: #d4380d; }
.sr-dot.o { background: #1a66cc; }
.sr-meta { display: block; color: var(--tx2); font-size: 11.5px; margin-top: 2px; }
.ok-tip { background: #eef4ff; color: #1a4b8c; border: 1px solid #b9d0ee;
  font-size: 12px; }
.ok-tip::before { border-right-color: #b9d0ee; }

.lp-exp { color: var(--pri); text-decoration: none; font-size: 12px; padding: 0 2px; }

/* ---- 台账页模块化 ---- */
.mod-head { display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.mod-head h3 { margin: 0; }
.mod-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.imp-label { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.imp-label input { max-width: 240px; }
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.stat-card { border: 1px solid var(--line); border-radius: 10px; padding: 8px 18px;
  text-align: center; background: #fafbfd; }
.sc-v { font-size: 19px; font-weight: 700; color: var(--pri); }
.sc-k { font-size: 12px; color: var(--tx2); margin-top: 2px; }

/* ---- 台账筛选下拉搜索 ---- */
.dd-wrap { position: relative; flex: 1; min-width: 180px; }
.dd-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 500;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 260px; overflow-y: auto; }
.dd-item { padding: 8px 12px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f2f4f7; }
.dd-item:hover { background: var(--pri-weak, #eef4ff); }
.dd-item:last-child { border-bottom: none; }
.dd-none { color: var(--tx2); cursor: default; }
.dd-code { color: var(--pri); font-size: 12px; margin-left: 6px; }
.dd-meta { color: var(--tx2); font-size: 11.5px; margin-left: 6px; }

/* ---- 研判清单端口列：限宽换行（手机友好） ---- */
.td-ports { max-width: 150px; }
.td-ports .pt-chip { display: block; margin: 2px 0; }   /* 一个端口一行：手机端横排 chips 会重叠遮挡 */
.td-box { min-width: 15em; max-width: 15em; white-space: normal; overflow-wrap: anywhere; }   /* 光交列固定15字宽：超出换行（须覆盖全局 td nowrap；窄屏走表格横滚） */
.pt-chip { display: inline-block; padding: 2px 7px; margin: 2px 3px 2px 0;
  border-radius: 5px; font-size: 12px; font-family: Consolas, monospace;
  white-space: nowrap; }
.pt-chip.cut { background: #fdeceb; color: #a3300a; border: 1px solid #f5c6c0; }
.pt-chip.ok { background: #eef4ff; color: #1a4b8c; border: 1px solid #c5d9f5; }
.dim { color: var(--tx2); font-size: 12px; }
@media (max-width: 640px) {
  .td-ports { max-width: 120px; }
  .pt-chip { font-size: 11px; padding: 1px 5px; }
}

/* ---- 多选下拉与已选标签 ---- */
.dd-item.on { background: #eef4ff; }
.dd-check { display: inline-block; width: 16px; color: var(--pri); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 2px; }
.chips-label { font-size: 12px; color: var(--tx2); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef4ff;
  border: 1px solid #c5d9f5; color: #1a4b8c; border-radius: 999px;
  padding: 2px 6px 2px 10px; font-size: 12.5px; }
.chip b { cursor: pointer; color: #7d93b5; font-weight: 700; padding: 0 2px; }
.chip b:hover { color: #d4380d; }

/* ---- 候选勾选框 ---- */
.dd-box { display: inline-block; width: 15px; height: 15px; line-height: 14px;
  text-align: center; border: 1px solid #c5cdd8; border-radius: 4px;
  font-size: 11px; color: #fff; margin-right: 7px; vertical-align: middle; }
.dd-item.on .dd-box { background: var(--pri); border-color: var(--pri); }

/* ---- 下拉「已选置顶区」 ---- */
.dd-sec { font-size: 11.5px; color: var(--tx2); padding: 6px 12px 3px; background: #fafbfd; }
.dd-sep { height: 1px; background: var(--line); margin: 4px 0; }
.dd-list .dd-item.on { background: #f0f6ff; }

/* ---- 筛选反馈条 & OLT 折叠 ---- */
.flt-info { font-size: 12.5px; color: #1a4b8c; background: #f0f6ff; border-radius: 6px;
  padding: 5px 10px; margin: 4px 0 0; }
.flt-info:empty { display: none; }
.olt-pick { margin: 8px 0 2px; }
.olt-pick summary { cursor: pointer; font-size: 12.5px; color: var(--tx2); }
.olt-pick[open] summary { margin-bottom: 2px; }

/* ---- 可收缩窗口（OLT 信息） ---- */
details.panel-fold { padding: 12px 16px; }
.fold-summary { cursor: pointer; list-style: none; display: flex; align-items: baseline;
  gap: 10px; flex-wrap: wrap; }
.fold-summary::-webkit-details-marker { display: none; }
.fold-summary::before { content: '▸'; color: var(--pri); font-size: 13px; margin-right: 2px; }
details.panel-fold[open] .fold-summary::before { content: '▾'; }
.fold-summary b { font-size: 15px; }
.fold-hint { font-size: 12px; color: var(--tx2); font-weight: 400; }
.fold-body { margin-top: 12px; }
.fold-body .mod-head { margin-bottom: 8px; }

/* ---- 明细区标题（非折叠，防误触） ---- */
.flt-title { font-size: 13.5px; font-weight: 600; color: var(--tx); margin-bottom: 6px; }
