/* ============================================================
 * 排版整改 切片 I6 —— 密钥管理页（keys.html）强化
 * M3 模型 & 密钥管理中心：分组列表 / 新增表单 / 连通性检测 /
 * 限流记录 / 模型配置模板 / 空态引导 / 底部安全说明
 * 只增量挂接：不改 workbench.html / style.css / 既有 js / 其他 rectify_*
 * 颜色全部复用既有 hex 与变量（浅蓝白体系），零深色引入
 * ============================================================ */

#i6Mount { margin-top: 4px; }

/* ---------- 顶部工具栏 ---------- */
.i6-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--v10-card, #fff);
  border: 1px solid rgba(22, 11, 255, .16);
  border-radius: var(--v10-radius, 16px);
  padding: 14px 18px; margin-bottom: 16px;
  box-shadow: 0 6px 22px rgba(29, 33, 41, .08);
}
.i6-tb-left { flex: 1; min-width: 200px; }
.i6-tb-title { font-size: 16px; font-weight: 700; color: #303133; display: flex; align-items: center; gap: 8px; }
.i6-tb-sum { font-size: 13px; color: #606266; margin-top: 3px; }
.i6-tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.i6-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: 12px; border: 0; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .18s; line-height: 1.2;
}
.i6-btn-primary { background: linear-gradient(90deg, #38BDF8, #38BDF8); color: #fff; }
.i6-btn-primary:hover { filter: brightness(1.07); }
.i6-btn-ghost { background: #e6f4ff; color: #1d2129; }
.i6-btn-ghost:hover { background: #DFEBF9; }
.i6-btn-danger { background: #ffece8; color: #f53f3f; }
.i6-btn-danger:hover { background: #f9d9d9; }
.i6-btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
/* 28 号禁用态 */
.i6-btn[disabled], .i6-btn.i6-disabled {
  background: #EDF2F8 !important; color: #9AA9BE !important; cursor: not-allowed; filter: none !important;
}
.i6-btn.is-loading { opacity: .75; cursor: progress; pointer-events: none; }

/* ---------- 分组卡片 ---------- */
.i6-group {
  background: var(--v10-card, #fff);
  border: 1px solid rgba(22, 11, 255, .16);
  border-radius: var(--v10-radius, 16px);
  margin-bottom: 14px; overflow: hidden;
  box-shadow: 0 6px 22px rgba(29, 33, 41, .08);
}
.i6-group-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; background: linear-gradient(90deg, #F4F9FF, #FFFFFF);
  border-bottom: 1px solid rgba(22, 11, 255, .14);
}
.i6-g-ic {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #e6f4ff; color: #0958d9;
}
.i6-g-name { font-size: 16px; font-weight: 700; color: #303133; }
.i6-g-count { font-size: 12px; color: #606266; background: #F0F4FA; border-radius: 999px; padding: 2px 9px; }
.i6-g-sum { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 4px; }
.i6-g-spacer { flex: 1; }

/* 状态胶囊（全局 .badge 规范） */
.i6-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.i6-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.i6-b-ok { background: #E7F4EA; color: #3B7A4F; }
.i6-b-fail { background: #ffece8; color: #f53f3f; }
.i6-b-low { background: #FFF7E8; color: #ff7d00; }
.i6-b-off { background: #F0F4FA; color: #606266; }

/* ---------- 密钥表格 ---------- */
.i6-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.i6-tbl thead th {
  text-align: left; font-size: 12px; font-weight: 600; color: #606266;
  padding: 9px 14px; background: #FAFCFF; border-bottom: 1px solid rgba(22, 11, 255, .14);
}
.i6-tbl tbody td { padding: 11px 14px; border-bottom: 1px solid #ffffff; vertical-align: middle; }
.i6-tbl tbody tr:last-child td { border-bottom: 0; }
.i6-tbl tbody tr:hover { background: #F8FBFF; }

.i6-cell-model { display: flex; align-items: center; gap: 10px; }
.i6-mchip {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.i6-note { font-weight: 600; color: #303133; }
.i6-note-sub { font-size: 12px; color: #9AA9BE; font-weight: 400; margin-top: 1px; }
.i6-vendor { color: #1d2129; font-size: 13px; }
.i6-masked { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; color: #606266; letter-spacing: .5px; }
.i6-masked .i6-tail { color: #3B7A4F; font-weight: 600; }

.i6-op { display: flex; gap: 6px; flex-wrap: nowrap; }
.i6-opbtn {
  border: 0; background: #e6f4ff; color: #1d2129; cursor: pointer;
  padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; transition: all .15s;
}
.i6-opbtn:hover { background: #DFEBF9; }
.i6-opbtn.i6-op-del { background: #ffece8; color: #f53f3f; }
.i6-opbtn.i6-op-del:hover { background: #f9d9d9; }
.i6-opbtn[disabled] { opacity: .6; cursor: progress; }
.i6-opbtn .i6-spin {
  display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: i6rot .7s linear infinite; vertical-align: -1px; margin-right: 4px;
}
@keyframes i6rot { to { transform: rotate(360deg); } }

/* ---------- 空态 ---------- */
.i6-empty {
  text-align: center; padding: 60px 20px;
  background: var(--v10-card, #fff);
  border: 1.5px dashed rgba(22, 11, 255, .4);
  border-radius: var(--v10-radius, 16px);
}
.i6-empty-ic { font-size: 44px; margin-bottom: 12px; }
.i6-empty-tx { font-size: 16px; font-weight: 700; color: #303133; margin-bottom: 6px; }
.i6-empty-sub { font-size: 14px; color: #606266; margin-bottom: 18px; }

/* ---------- 弹窗 ---------- */
.i6-mask {
  position: fixed; inset: 0; background: rgba(30, 42, 58, .42); z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.i6-mask.show { opacity: 1; pointer-events: auto; }
.i6-modal {
  background: #fff; border-radius: 16px; padding: 22px 24px;
  width: min(480px, 94vw); max-height: 88vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(29, 33, 41, .28);
  transform: translateY(8px); transition: transform .18s;
}
.i6-mask.show .i6-modal { transform: translateY(0); }
.i6-modal.wide { width: min(680px, 96vw); }
.i6-modal h3 { font-size: 16px; color: #303133; margin-bottom: 3px; }
.i6-modal-desc { font-size: 13px; color: #606266; margin-bottom: 14px; }

/* 表单：标签固定宽左对齐、输入框一条竖线（41 号表单对齐规范） */
.i6-field { display: flex; align-items: flex-start; gap: 12px; margin: 13px 0; }
.i6-field > label {
  flex: none; width: 78px; text-align: right;
  font-size: 13px; color: #606266; padding-top: 9px; line-height: 1.3;
}
.i6-field .i6-ctl { flex: 1; min-width: 0; }
.i6-input, .i6-select {
  width: 100%; padding: 9px 12px; font-size: 14px; color: #303133;
  border: 0; border-bottom: 1.5px solid #C9DCEF; border-radius: 0;
  background: #ffffff; outline: none; transition: border-color .15s;
}
.i6-input:focus, .i6-select:focus { border-bottom-color: #38BDF8; }
.i6-input::placeholder { color: #A9BBD2; }
.i6-input-wrap { position: relative; }
.i6-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; cursor: pointer; padding: 4px; color: #38BDF8;
  display: flex; align-items: center;
}
.i6-eye:hover { color: #38BDF8; }
.i6-hint { font-size: 12px; color: #9AA9BE; margin-top: 5px; line-height: 1.5; }
.i6-hint.warn { color: #ff7d00; }

.i6-modal-ft { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* 报错模板 29 号：问题+原因+建议 */
.i6-errbox { border-top: 3px solid #f53f3f; }
.i6-errrow { padding: 10px 0; border-bottom: 1px dashed #f5f7fa; font-size: 14px; line-height: 1.6; }
.i6-errrow:last-of-type { border-bottom: 0; }
.i6-errrow b { color: #303133; display: inline-block; min-width: 44px; }
.i6-errrow .i6-e-q { color: #f53f3f; font-weight: 700; }
.i6-errrow .i6-e-a { color: #606266; }
.i6-errrow .i6-e-s { color: #3B7A4F; }

/* ---------- 限流记录面板 ---------- */
.i6-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 16px; }
.i6-stat {
  background: #F4F9FF; border: 1px solid rgba(22, 11, 255, .18);
  border-radius: 12px; padding: 12px 14px;
}
.i6-stat-n { font-size: 24px; font-weight: 700; color: #1d2129; }
.i6-stat-n.bad { color: #f53f3f; }
.i6-stat-l { font-size: 12px; color: #606266; margin-top: 3px; }

.i6-logtbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.i6-logtbl th {
  text-align: left; font-size: 12px; color: #606266; padding: 7px 10px;
  background: #FAFCFF; border-bottom: 1px solid rgba(22, 11, 255, .16);
}
.i6-logtbl td { padding: 9px 10px; border-bottom: 1px solid #ffffff; vertical-align: top; }
.i6-logtbl .i6-code {
  display: inline-block; background: #ffece8; color: #f53f3f;
  border-radius: 8px; padding: 1px 7px; font-size: 12px; font-weight: 700;
}
.i6-log-empty { text-align: center; color: #9AA9BE; padding: 26px; font-size: 13px; }

/* ---------- 模型配置模板 ---------- */
.i6-tpl {
  border: 1px solid rgba(22, 11, 255, .2); border-radius: 13px;
  padding: 14px 16px; margin-bottom: 12px; background: #ffffff;
}
.i6-tpl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.i6-tpl-name { font-weight: 700; color: #303133; font-size: 16px; }
.i6-tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.i6-tpl-grid .i6-fld label { display: block; font-size: 12px; color: #606266; margin-bottom: 4px; }
.i6-tpl-grid .i6-fld input, .i6-tpl-grid .i6-fld select {
  width: 100%; padding: 7px 9px; font-size: 13px; border: 1px solid #dcdfe6;
  border-radius: 8px; background: #fff; outline: none; color: #303133;
}
.i6-tpl-grid .i6-fld input:focus, .i6-tpl-grid .i6-fld select:focus { border-color: #38BDF8; }
.i6-tpl-bind { margin-left: auto; font-size: 12px; color: #606266; display: flex; align-items: center; gap: 6px; }
.i6-tpl-bind select { padding: 4px 8px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 12px; background: #fff; color: #303133; }

/* ---------- Toast ---------- */
.i6-toast {
  position: fixed; left: 50%; bottom: 38px; transform: translate(-50%, 12px);
  background: #303133; color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; box-shadow: 0 10px 30px rgba(30, 58, 92, .3);
  max-width: 80vw;
}
.i6-toast.show { opacity: 1; transform: translate(-50%, 0); }
.i6-toast.i6-t-ok { background: #2F8A5B; }
.i6-toast.i6-t-warn { background: #f53f3f; }

/* ---------- 底部安全说明 ---------- */
.i6-security {
  margin-top: 18px; padding: 12px 16px; border-radius: 12px;
  background: #F4F9FF; border: 1px dashed rgba(22, 11, 255, .35);
  font-size: 13px; color: #606266; line-height: 1.8;
}
.i6-security b { color: #1d2129; }

/* 表格在窄屏横向滚动 */
.i6-tblwrap { overflow-x: auto; }
.i6-tbl { min-width: 720px; }

@media (max-width: 767px) {
  .i6-tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .i6-stats { grid-template-columns: 1fr; }
  .i6-field > label { width: 64px; }
}
