/*! v7工作室AI版 · [R198] 顶栏「设置」入口 + 内嵌设置中心（纯皮肤层）
 * 搭配 mk-r198.js：左栏分区导航 + 右侧真实页面 iframe 内嵌（?mkEmbed=1 只留内容）。
 * 删掉 index.html 里这两行即回退。
 * ========================================================================== */

/* ---------- 顶栏入口 ---------- */
#mk198-settings-btn { color: #33415c !important; }
#mk198-settings-btn svg { color: #4f6ef7; width: 15px; height: 15px; }
#mk198-settings-btn.active {
  background: #eef3ff !important; border-color: #c9d8ff !important; color: #2b47c7 !important;
}
/* 隐藏被搬进「设置」的原按钮：mk-r32-home.css 的 `:has(.table-area) … .nav-btn{inline-flex!important}`
   权重(0,6,2)更高，这里用重复类名抬到 (0,7,2) 压过它（保留节点，React 路由/事件照旧） */
html body .app .header .mk-topnav > .mk198-hidden.mk198-hidden.mk198-hidden.mk198-hidden { display: none !important; }

/* ---------- 设置中心（覆盖在顶栏下方的内容区） ---------- */
.mk198-shell {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9420;
  display: none; background: #f6f8fb;
  font-family: inherit; color: #0f172a;
}
.mk198-shell.is-open { display: flex; }

/* 左栏：分区导航 */
.mk198-rail {
  width: 198px; flex: 0 0 198px; box-sizing: border-box;
  background: #fff; border-right: 1px solid #eef1f6;
  display: flex; flex-direction: column; padding: 14px 12px;
}
.mk198-railhd { display: flex; align-items: center; gap: 8px; padding: 2px 8px 12px; }
.mk198-railhd strong { font-size: 14.5px; font-weight: 700; letter-spacing: .2px; }
.mk198-rico { display: inline-flex; color: #4f6ef7; }
.mk198-rico svg { width: 17px; height: 17px; }
.mk198-railbody { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 3px; }
.mk198-tab {
  position: relative; display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 10px; box-sizing: border-box;
  border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-size: 13px; color: #475569; text-align: left; cursor: pointer;
}
.mk198-tab svg { width: 16px; height: 16px; flex: 0 0 16px; color: #94a3b8; }
.mk198-tab span { white-space: nowrap; }
.mk198-tab:hover { background: #f4f7fc; color: #1f2b45; }
.mk198-tab.active { background: #eef3ff; color: #2b47c7; font-weight: 600; }
.mk198-tab.active svg { color: #4f6ef7; }
.mk198-tab.active:before {
  content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 0 3px 3px 0; background: #4f6ef7;
}
.mk198-back {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-top: 10px;
  border: 1px solid #e3eaf4; border-radius: 9px; background: #fff;
  font: inherit; font-size: 12.5px; color: #64748b; cursor: pointer;
}
.mk198-back svg { width: 15px; height: 15px; }
.mk198-back:hover { border-color: #c7d4e6; color: #1f2b45; }

/* 右侧：内容区 */
.mk198-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mk198-panehd {
  height: 44px; flex: 0 0 44px; box-sizing: border-box;
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: #fff; border-bottom: 1px solid #eef1f6;
}
.mk198-ptitle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #0f172a; }
.mk198-ptitle svg { width: 16px; height: 16px; color: #4f6ef7; }
.mk198-ico {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #e3eaf4; border-radius: 8px; background: #fff; color: #94a3b8;
  cursor: pointer; padding: 0;
}
.mk198-ico svg { width: 14px; height: 14px; }
.mk198-ico:hover { border-color: #c7d4e6; color: #334155; }
.mk198-new { margin-left: auto; }
.mk198-stage { position: relative; flex: 1; min-height: 0; background: #fff; }
.mk198-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.mk198-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 13px; color: #94a3b8; background: #fff; transition: opacity .18s ease;
}
.mk198-loading.is-off { opacity: 0; pointer-events: none; }
.mk198-spin {
  width: 14px; height: 14px; border: 2px solid #dbe3ee; border-top-color: #4f6ef7;
  border-radius: 50%; animation: mk198-spin .8s linear infinite;
}
@keyframes mk198-spin { to { transform: rotate(360deg) } }

/* ---------- 嵌入模式（iframe 内命中 ?mkEmbed=1）：只留内容 ---------- */
html.mk198-embed .header,
html.mk198-embed .sidebar,
html.mk198-embed canvas.mk-particle-bg,
html.mk198-embed .mky-dock,
html.mk198-embed #mkYieldDock,
html.mk198-embed .mk-float-album { display: none !important; }
html.mk198-embed .main {
  height: 100vh !important; padding: 0 !important; margin: 0 !important;
  overflow: auto !important;
}
html.mk198-embed .main > * { max-width: none !important; }
html.mk198-embed .table-area { padding: 14px 16px !important; }

/* 窄屏（内嵌设置不再折叠左栏，只压缩宽度） */
@media (max-width: 1100px) {
  .mk198-rail { width: 168px; flex: 0 0 168px; }
  .mk198-tab span { font-size: 12.5px; }
}

/* ---------- 控制页（/panel/device）顶栏齿轮小入口（与 R197 报表/汇率并排） ---------- */
.ctrl-topbar .mk198-ctlwrap { display: inline-flex; align-items: center; gap: 6px; }
.ctrl-topbar .mk198-ctlbtn {
  width: 28px; height: 28px; flex: 0 0 28px; margin-left: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #dbe3ee; border-radius: 8px; background: #fff;
  color: #475569; cursor: pointer; padding: 0; box-shadow: none;
}
.ctrl-topbar .mk198-ctlbtn svg { width: 15px; height: 15px; color: #4f6ef7; }
.ctrl-topbar .mk198-ctlbtn:hover { border-color: #b9c8de; color: #1f2b45; }
.ctrl-topbar .mk198-ctlbtn.active { background: #eef3ff; border-color: #c9d8ff; color: #2b47c7; }
