/* ==========================================================================
   H3C 交换机配置生成器 —— 样式表（零外部依赖）
   度量与「物资采购计算单」保持一致：56px 顶栏渐变 / 卡片 8px 圆角 / .fg 3 列网格 /
   .tbl 表格 / .btn 按钮 / .mc chips / .sb 绿色汇总卡 / .mo 模态框 / Toast
   ========================================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f0f2f5;
  --card: #fff;
  --pri: #3b82f6;
  --pri-h: #2563eb;
  --err: #ef4444;
  --err-h: #dc2626;
  --t: #1e293b;
  --ts: #64748b;
  --b: #e2e8f0;
  --sh: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --mono: Consolas, "Courier New", monospace;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--t); line-height: 1.6; font-size: 14px;
}
a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

/* ── 顶栏（与物资采购 .hd 同度量） ── */
.hd {
  background: linear-gradient(135deg, #1e3a5f, #2563eb); color: #fff;
  display: flex; align-items: center; height: 56px; padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15); position: sticky; top: 0; z-index: 100;
}
.hd .b { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; white-space: nowrap; }
.hd .b .ic { font-size: 24px; }
.hd .b .v { font-size: 11px; font-weight: 500; opacity: .6; margin-left: 2px; }
.nb { display: flex; gap: 4px; margin-left: 40px; height: 100%; align-items: flex-end; overflow-x: auto; }
.nbi {
  padding: 6px 18px; background: none; border: none; color: rgba(255, 255, 255, .65);
  font-size: 14px; cursor: pointer; border-radius: 6px 6px 0 0; transition: .2s;
  font-family: inherit; white-space: nowrap; line-height: 1.6;
}
.nbi:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nbi.on { color: #fff; background: rgba(255, 255, 255, .15); font-weight: 600; }
.hd .sp { flex: 1; }
.hd .hbtn {
  padding: 6px 14px; background: rgba(255, 255, 255, .15); border: none; color: #fff;
  border-radius: 6px; font-size: 13px; cursor: pointer; font-family: inherit; margin-left: 8px;
  transition: .15s;
}
.hd .hbtn:hover { background: rgba(255, 255, 255, .28); }
.hd .hbtn.pri { background: #fff; color: #1e3a5f; font-weight: 600; }
.hd .hbtn.pri:hover { background: #e0edff; }

/* ── 常驻状态条 ── */
.stb {
  display: flex; align-items: center; gap: 0; flex-wrap: wrap;
  padding: 8px 24px; background: #fff; border-bottom: 1px solid var(--b);
  position: sticky; top: 56px; z-index: 90;
}
.stb .it { font-size: 12.5px; color: var(--ts); white-space: nowrap; padding: 0 14px; border-right: 1px solid var(--b); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.stb .it:first-child { padding-left: 0; }
.stb .it b { color: var(--t); font-weight: 600; font-size: 13px; margin-left: 6px; }
.stb .it b.mono { font-family: var(--mono); color: var(--pri-h); overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 34vw; vertical-align: bottom; }
.stb .sp { flex: 1; }
.bdg {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600;
  background: #f1f5f9; color: #475569; border: 1px solid var(--b); cursor: pointer; font-family: inherit;
}
.bdg:hover { filter: brightness(.97); }
.bdg.err { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.bdg.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.bdg.ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.bdg.info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.hlink { background: none; border: none; color: var(--pri); cursor: pointer; font-size: 12.5px; padding: 2px 8px; font-family: inherit; }
.hlink:hover { text-decoration: underline; }

/* ── 容器 ── */
.ctn { max-width: 1200px; margin: 0 auto; padding: 20px 24px 40px; }
.tp { display: none; }
.tp.on { display: block; }
.sub { display: none; }
.sub.on { display: block; }

/* ── 二级导航（标签页样式，贴卡片上沿） ── */
.snav {
  display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 0;
  align-items: flex-end;
}
.sni {
  padding: 8px 18px; border: 1px solid transparent; border-bottom: none;
  border-radius: 8px 8px 0 0; font-size: 13.5px; cursor: pointer; color: var(--ts);
  background: #e8ecf1; font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
  transition: .15s; margin-right: 2px;
}
.sni:hover { background: #dde5ee; color: var(--pri-h); }
.sni.on {
  background: var(--card); color: var(--t); font-weight: 600;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, .06); position: relative; top: 1px;
}
.sni .pip { font-size: 11px; background: rgba(0, 0, 0, .08); border-radius: 8px; padding: 0 6px; line-height: 16px; }
.sni.on .pip { background: #dbeafe; color: #1e40af; }

/* ── 工具栏 ── */
.tb { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.tb h2 { font-size: 20px; font-weight: 700; }
.tb .ds { font-size: 13px; color: var(--ts); font-weight: 400; margin-left: 10px; }
.af { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.af select { padding: 6px 10px; border: 1px solid var(--b); border-radius: 6px; font-size: 13px; background: #fff; cursor: pointer; }

/* ── 按钮（与物资采购同度量） ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 18px; border: 1px solid var(--b); border-radius: 6px; font-size: 14px;
  font-weight: 500; cursor: pointer; transition: .15s; font-family: inherit;
  white-space: nowrap; background: #fff; color: var(--t);
}
.btn:hover { border-color: var(--pri); color: var(--pri); }
.bp { background: var(--pri); color: #fff; border-color: var(--pri); }
.bp:hover { background: var(--pri-h); color: #fff; }
.bd { background: var(--err); color: #fff; border-color: var(--err); }
.bd:hover { background: var(--err-h); color: #fff; }
.bs { padding: 5px 12px; font-size: 12px; }
.bl { background: none; border: none; color: var(--pri); cursor: pointer; font-size: 13px; padding: 2px 6px; font-family: inherit; }
.bl:hover { text-decoration: underline; }
.bl.dn { color: var(--err); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.lk { color: var(--pri); font-size: 12px; white-space: nowrap; }
.lk:hover { text-decoration: underline; }
.lk.dng { color: var(--err); }

/* ── 卡片：表单卡 .fc / 表格卡 .tc（与物资采购一致） ── */
.fc {
  background: var(--card); border-radius: 8px; box-shadow: var(--sh);
  padding: 24px; margin-bottom: 16px; border-left: 4px solid var(--pri);
}
.fc h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fc h3 .hint, .tc h3 .hint { font-size: 12.5px; font-weight: 400; color: var(--ts); }
.fc h3 .rt, .tc h3 .rt { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tc {
  background: var(--card); border-radius: 8px; box-shadow: var(--sh);
  padding: 20px; margin-bottom: 16px;
}
.tc h3 { font-size: 16px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc.first { border-radius: 0 8px 8px 8px; }

/* ── 表单网格 ── */
.fg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fg.c4 { grid-template-columns: repeat(4, 1fr); }
.fi { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fi.full { grid-column: 1 / -1; }
.fi.s2 { grid-column: span 2; }
.fi.s3 { grid-column: span 3; }
.fi label { font-size: 13px; font-weight: 600; color: var(--ts); display: flex; align-items: center; gap: 6px; }
.fi label .rq { color: var(--err); }
.fi input, .fi select, .fi textarea {
  padding: 8px 12px; border: 1px solid var(--b); border-radius: 6px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--t); width: 100%;
}
.fi input:focus, .fi select:focus, .fi textarea:focus {
  outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}
.fi input:disabled, .fi select:disabled { background: #f8fafc; color: #94a3b8; }
.fi textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; line-height: 1.6; }
.fi .tip { font-size: 12px; color: #94a3b8; }
.fi .chk { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13.5px; font-weight: 500; }
.fi .chk label { font-size: 13.5px; font-weight: 500; color: var(--t); }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--pri); cursor: pointer; }
.fa { grid-column: 1 / -1; display: flex; gap: 10px; padding-top: 8px; flex-wrap: wrap; align-items: center; }
hr.sep { border: none; border-top: 1px solid var(--b); margin: 16px 0; }

/* ── 行内新增/编辑表单卡（物资采购 matForm 模式） ── */
.ifm { display: none; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.ifm.on { display: block; }
.ifm h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.ifm h4 .hint { font-weight: 400; font-size: 12.5px; color: var(--ts); }
.ifm .fg { grid-template-columns: repeat(3, 1fr); }
.ifm .fg.c4 { grid-template-columns: repeat(4, 1fr); }

/* ── 表格（与物资采购 .tbl 同度量） ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--b); vertical-align: middle; }
.tbl th { background: #f8fafc; font-weight: 600; font-size: 12px; color: var(--ts); text-transform: uppercase; white-space: nowrap; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.sel { background: #eff6ff; }
.tbl tbody tr.flash { animation: fl 2s ease-out; }
@keyframes fl { 0%, 35% { background: #fef3c7; } 100% { background: transparent; } }
.tbl .act { white-space: nowrap; text-align: right; }
.tbl .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 13px; }
.tsc { max-height: 560px; overflow: auto; border: 1px solid var(--b); border-radius: 8px; }
.tsc .tbl th { position: sticky; top: 0; z-index: 1; }
.tsc .tbl { font-size: 13px; }
.tsc .tbl th, .tsc .tbl td { padding: 8px 10px; }
/* 端口表：高度跟随视口，充分利用屏幕、减少页面下方空白 */
.tsc.fill { max-height: calc(100vh - 300px); min-height: 320px; }
@media (max-height: 800px) { .tsc.fill { max-height: calc(100vh - 260px); } }
/* 端口表列宽：固定列宽 + 名称不换行，避免横向溢出把操作列挤掉 */
.port-tbl { table-layout: fixed; }
.port-tbl th, .port-tbl td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.port-tbl td:first-child, .port-tbl th:first-child { padding-left: 8px; padding-right: 0; }
/* 接口列：类型徽标 + 缩写名同一行，不换行 */
.port-tbl td:nth-child(2) { display: flex; align-items: center; gap: 4px; }
.port-tbl td:nth-child(2) .bg { flex: 0 0 auto; padding: 1px 5px; font-size: 11px; }
.port-tbl td:nth-child(2) .mono { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.port-tbl td .mono { font-size: 12.5px; }
.port-tbl td input[type=text] { width: 100% !important; box-sizing: border-box; padding: 4px 6px; font-size: 12.5px; }
.port-tbl td select { width: 100% !important; box-sizing: border-box; padding: 4px 6px; font-size: 12.5px; }
.port-tbl td .lk { font-size: 12px; }
.port-tbl td input[type=checkbox] { margin: 0; }

/* ── 批量操作条 ── */
.bb { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.bb .fi { flex: 0 1 150px; }
.bb .fi.grow { flex: 1 1 220px; }
.bb .fi label { font-size: 12px; }
.bb .fi input, .bb .fi select { padding: 6px 10px; font-size: 13px; }
.bb .fi .btn { width: 100%; }

/* ── 空状态（物资采购 .em，克制版图标） ── */
.em { text-align: center; padding: 48px 20px; color: var(--ts); }
.em .ic { font-size: 48px; margin-bottom: 12px; }
.em p { font-size: 14px; }
.emic { font-size: 32px; line-height: 1; margin-bottom: 10px; color: #cbd5e1; }

/* ── 标签小徽标 .bg ── */
.bg { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #f1f5f9; color: #475569; }
.bg.blue { background: #dbeafe; color: #1e40af; }
.bg.green { background: #dcfce7; color: #166534; }
.bg.yellow { background: #fef3c7; color: #92400e; }
.bg.red { background: #fee2e2; color: #991b1b; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── chips（物资采购 .mg/.mc） ── */
.mg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.mc {
  padding: 6px 14px; border: 1px solid var(--b); border-radius: 20px; font-size: 13px;
  cursor: pointer; transition: .15s; background: #fff; user-select: none; color: var(--t); font-family: inherit;
}
.mc:hover { border-color: var(--pri); color: var(--pri); }
.mc.sel { background: var(--pri); color: #fff; border-color: var(--pri); }

/* ── 汇总卡（物资采购 .sb） ── */
.sb { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 16px 20px; margin-top: 12px; }
.sb h4 { color: #166534; margin-bottom: 8px; font-size: 14px; }
.sb .sl { font-size: 13px; color: #166534; margin: 2px 0; line-height: 1.6; }
.sb .gt { font-size: 18px; font-weight: 700; color: var(--err); margin-top: 8px; padding-top: 8px; border-top: 1px solid #bbf7d0; }
.sb.warn { background: #fffbeb; border-color: #fde68a; }
.sb.warn h4, .sb.warn .sl { color: #92400e; }
.sb.warn .gt { color: #b45309; border-top-color: #fde68a; }
.sb.bad { background: #fef2f2; border-color: #fecaca; }
.sb.bad h4, .sb.bad .sl { color: #991b1b; }
.sb.bad .gt { color: var(--err-h); border-top-color: #fecaca; }
.sb .kv { color: #166534; }

/* ── 校验说明 / 问题清单 ── */
.ivint {
  background: #eff6ff; border: 1px solid #bfdbfe; border-left: 4px solid var(--pri);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; font-size: 13.5px;
  color: #1e3a5f; line-height: 1.7;
}
.ivint b { color: var(--err-h); }
.ivint i { font-style: normal; font-weight: 700; color: #b45309; }
.ivint u { text-decoration: none; font-weight: 700; color: var(--pri-h); }
.issue {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--b); border-radius: 8px; margin-bottom: 8px; background: #fff;
}
.issue .lvb { flex: 0 0 auto; min-width: 52px; text-align: center; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 10px; }
.issue.error { border-left: 3px solid var(--err); }
.issue.error .lvb { background: #fee2e2; color: #991b1b; }
.issue.warning { border-left: 3px solid #f59e0b; }
.issue.warning .lvb { background: #fef3c7; color: #92400e; }
.issue.info { border-left: 3px solid var(--pri); }
.issue.info .lvb { background: #dbeafe; color: #1e40af; }
.issue.note { border-left: 3px solid #94a3b8; }
.issue.note .lvb { background: #f1f5f9; color: #475569; }
.issue .fld { flex: 0 0 130px; font-family: var(--mono); font-size: 12px; color: var(--ts); word-break: break-all; padding-top: 2px; }
.issue .tx { flex: 1 1 auto; font-size: 13.5px; line-height: 1.55; }
.issue .go { flex: 0 0 auto; }
.rules { width: 100%; border-collapse: collapse; font-size: 13px; }
.rules th, .rules td { padding: 8px 10px; border-bottom: 1px solid var(--b); text-align: left; vertical-align: top; }
.rules th { background: #f8fafc; font-size: 12px; color: var(--ts); text-transform: uppercase; }

/* ── 配置查看器 ── */
.vw {
  margin: 0; background: #0f172a; color: #dbeafe; border-radius: 8px; padding: 12px 0;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; max-height: 600px; overflow: auto; white-space: pre;
}
.vw .cl { display: block; padding: 0 14px; }
.vw .cl:hover { background: rgba(255, 255, 255, .06); }
.vw .ln { display: inline-block; width: 42px; text-align: right; margin-right: 12px; color: #475569; user-select: none; }
.vw.nolines .ln { display: none; }
.vw .cmt { color: #64748b; }
.dadd { display: block; background: rgba(34, 197, 94, .12); color: #86efac; }
.ddel { display: block; background: rgba(239, 68, 68, .12); color: #fca5a5; }
.split2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── 模态框（物资采购 .mo/.md） ── */
.mo { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 200; justify-content: center; align-items: center; padding: 20px; }
.mo.show { display: flex; }
.md { background: #fff; border-radius: 12px; width: 92%; max-width: 760px; max-height: 80vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0, 0, 0, .15); }
.md.wide { max-width: 980px; }
.mdh { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--b); position: sticky; top: 0; background: #fff; border-radius: 12px 12px 0 0; z-index: 1; }
.mdh h3 { font-size: 17px; font-weight: 700; }
.mdc { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ts); line-height: 1; }
.mdb { padding: 20px 24px; }
.mdf { padding: 16px 24px; border-top: 1px solid var(--b); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Toast（物资采购同款） ── */
#toast { position: fixed; top: 70px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; min-width: 240px; min-height: 40px; }
.toast-item {
  padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18); max-width: 360px; word-break: break-all;
  animation: tIn .25s ease-out; transition: opacity .4s, transform .4s; background: #16a34a;
}
.toast-item.err { background: #dc2626; }
.toast-item.out { opacity: 0; transform: translateX(20px); }
@keyframes tIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ── 其他小件 ── */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--ts); }
.muted { color: var(--ts); font-size: 12.5px; }
.lst { display: flex; flex-direction: column; gap: 6px; }
.li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--b); border-radius: 8px; font-size: 13px; background: #fff; }
.li:hover { border-color: var(--pri); }
.li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 窄屏 ── */
@media (max-width: 900px) {
  .hd { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .nb { margin-left: 0; width: 100%; }
  .nbi { padding: 6px 12px; font-size: 13px; }
  .stb { position: static; padding: 8px 14px; }
  .stb .it { padding: 0 8px; }
  .ctn { padding: 14px; }
  .fg, .fg.c4, .ifm .fg, .ifm .fg.c4 { grid-template-columns: 1fr; }
  .fi.s2, .fi.s3 { grid-column: auto; }
  .split2 { grid-template-columns: 1fr; }
  .tb .ds { display: block; margin-left: 0; }
  .bb .fi { flex: 1 1 140px; }
  .issue .fld { flex-basis: 100%; }
  .sni { padding: 6px 12px; font-size: 12.5px; }
}
