/* ===========================================================
   合合通 · 数据驾驶舱  样式表
   结构：数据层（全屏，承载链接页面） + 菜单层（悬浮，鼠标移入
   左侧边缘呼出、移出自动收起）
   主色：农业绿 #5B8C3E / 科技蓝 #1A73E8
   =========================================================== */

:root {
  --bg-0: #050d19;
  --bg-1: #08182c;
  --panel-2: rgba(20, 42, 70, 0.6);
  --line: rgba(120, 200, 255, 0.14);
  --line-strong: rgba(120, 200, 255, 0.28);
  --green: #5b8c3e;
  --green-light: #8cc63f;
  --blue: #1a73e8;
  --cyan: #22d3ee;
  --text: #e8f2ff;
  --text-dim: #9db4d4;
  --text-mute: #6d87a8;
  --menu-w: 280px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(26, 115, 232, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(91, 140, 62, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 200, 255, 0.22); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= 数据层（全屏） ================= */
.data-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
}

.frame {
  width: 100%; height: 100%;
  border: 0;
  display: block;
  background: #0a1626;
}
.frame[hidden] { display: none; }

/* 未配置链接时的默认页面：正在开发中 · 敬请期待 */
.placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 200, 255, 0.03) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(120, 200, 255, 0.03) 0 1px, transparent 1px 56px),
    radial-gradient(700px 360px at 50% 38%, rgba(26, 115, 232, 0.16), transparent 70%),
    radial-gradient(500px 260px at 50% 78%, rgba(91, 140, 62, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(11, 26, 46, 0.97), rgba(6, 16, 30, 0.98));
  overflow: hidden;
}
.placeholder[hidden] { display: none; }

/* 中央取景框 + 四角装饰 */
.ph-frame {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 68px 96px 60px;
  text-align: center;
  max-width: 720px;
}
.ph-corner {
  position: absolute;
  width: 28px; height: 28px;
  border: 2px solid rgba(140, 198, 63, 0.7);
  filter: drop-shadow(0 0 6px rgba(140, 198, 63, 0.4));
}
.ph-corner.tl { left: 0; top: 0; border-right: none; border-bottom: none; border-top-left-radius: 10px; }
.ph-corner.tr { right: 0; top: 0; border-left: none; border-bottom: none; border-top-right-radius: 10px; border-color: rgba(34, 211, 238, 0.7); filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.4)); }
.ph-corner.bl { left: 0; bottom: 0; border-right: none; border-top: none; border-bottom-left-radius: 10px; border-color: rgba(34, 211, 238, 0.7); filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.4)); }
.ph-corner.br { right: 0; bottom: 0; border-left: none; border-top: none; border-bottom-right-radius: 10px; }

/* 背景光晕 */
.ph-halo {
  position: absolute;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 140, 62, 0.22), rgba(26, 115, 232, 0.10) 45%, transparent 70%);
  animation: halo 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes halo {
  0%, 100% { transform: scale(1); opacity: .75; }
  50% { transform: scale(1.12); opacity: 1; }
}

.ph-icon {
  position: relative;
  width: 96px; height: 96px;
  display: grid; place-items: center;
  border-radius: 26px;
  color: var(--green-light);
  border: 1px solid var(--line-strong);
  background: rgba(91, 140, 62, 0.14);
  box-shadow: 0 0 34px rgba(140, 198, 63, 0.22), inset 0 0 20px rgba(26, 115, 232, 0.12);
  animation: float 4s ease-in-out infinite;
}
/* 图标外圈旋转虚线光环 */
.ph-icon::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 34px;
  border: 1px dashed rgba(140, 198, 63, 0.45);
  animation: spin 16s linear infinite;
}
.ph-icon svg { width: 46px; height: 46px; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.ph-main {
  position: relative;
  margin: 10px 0 0;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 12px;
  text-indent: 12px;
  background: linear-gradient(90deg, #ffffff, #b9ecb0 45%, #7cc4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(124, 196, 255, 0.22));
}
.ph-sub {
  position: relative;
  margin: 0;
  font-size: 15px;
  letter-spacing: 6px;
  text-indent: 6px;
  color: var(--text-dim);
}
.ph-sub::before,
.ph-sub::after {
  content: "";
  display: inline-block;
  width: 26px; height: 1px;
  vertical-align: middle;
  margin: 0 14px;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}
.ph-sub::after { background: linear-gradient(90deg, var(--line-strong), transparent); }

.ph-divider {
  position: relative;
  width: 72px; height: 2px;
  margin: 10px 0 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--green-light), var(--cyan));
  opacity: .8;
}

.ph-module {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(20, 42, 70, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.ph-module-tag { font-size: 12px; color: var(--text-mute); }
.ph-module strong { font-size: 14px; color: var(--text); letter-spacing: 1px; }

.loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: rgba(6, 16, 30, 0.55);
  color: var(--text-dim);
  font-size: 13px;
}
.loading[hidden] { display: none; }
.spinner {
  width: 22px; height: 22px;
  border: 2px solid rgba(120, 200, 255, 0.25);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================= 左侧边缘感应区 ================= */
.edge-hotzone {
  position: fixed;
  left: 0; top: 0;
  width: 18px; height: 100%;
  z-index: 85;               /* 低于菜单层，高于数据层 */
  cursor: pointer;
}
.edge-hotzone::after {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 96px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, var(--green-light), var(--cyan));
  opacity: 0.3;
  transition: opacity .2s, width .2s, box-shadow .2s;
}
.edge-hotzone:hover::after {
  opacity: 1;
  width: 6px;
  box-shadow: 0 0 14px rgba(140, 198, 63, 0.85);
}

/* ================= 菜单层（悬浮） ================= */
.menu-layer {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--menu-w);
  z-index: 90;               /* 菜单层在数据层之上 */
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 30, 52, 0.97), rgba(6, 16, 30, 0.97));
  border-right: 1px solid var(--line-strong);
  border-radius: 0 16px 16px 0;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  transform: translateX(-104%);
  transition: transform .26s ease;
  overflow: hidden;
}
.menu-layer.open { transform: translateX(0); }

.brand {
  height: 62px;
  flex: 0 0 62px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand-logo {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line-strong);
}
.brand-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.4; overflow: hidden; }
.brand-text strong {
  font-size: 14px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.menu {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  padding: 0 12px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  position: relative;
  transition: background .18s, color .18s, border-color .18s;
}
.menu-item:hover { background: rgba(120, 200, 255, 0.07); color: var(--text); }
.menu-item .mi-icon { width: 20px; height: 20px; flex: 0 0 20px; }
.menu-item .menu-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-item .mi-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-mute); opacity: .55; flex: 0 0 6px;
}
.menu-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(91, 140, 62, 0.35), rgba(26, 115, 232, 0.22));
  border-color: var(--line-strong);
}
.menu-item.active::before {
  content: "";
  position: absolute; left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px;
  background: linear-gradient(180deg, var(--green-light), var(--cyan));
  box-shadow: 0 0 10px rgba(140, 198, 63, .8);
}
.menu-item.active .mi-dot { background: var(--green-light); opacity: 1; }

/* 二级菜单 */
.menu-parent .mi-arrow {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  color: var(--text-mute);
  transition: transform .2s ease, color .2s;
}
.menu-parent.open .mi-arrow { transform: rotate(90deg); color: var(--green-light); }
.menu-parent.parent-active {
  color: var(--text);
  background: rgba(91, 140, 62, 0.16);
  border-color: var(--line);
}
.menu-parent.parent-active .mi-arrow { color: var(--green-light); }

.submenu {
  position: relative;
  margin: -2px 0 8px;
  padding: 0 10px 0 26px;
}
.submenu::before {
  content: "";
  position: absolute;
  left: 28px; top: 2px; bottom: 10px;
  width: 1px;
  background: linear-gradient(180deg, var(--line-strong), transparent);
}
.menu-sub {
  height: 40px;
  font-size: 13px;
  padding: 0 10px;
  margin-bottom: 4px;
}
.menu-sub .mi-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.menu-sub.active::before { height: 18px; }

.menu-empty {
  padding: 20px 12px;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
  line-height: 1.8;
}

.menu-foot {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid var(--line);
}
.foot-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  height: 40px; padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 13px; font-family: inherit;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.foot-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }
.foot-btn:hover { background: rgba(120, 200, 255, 0.12); color: var(--text); }

/* ================= 通用按钮 ================= */
.ghost-btn, .primary-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ghost-btn {
  border: 1px solid var(--line-strong);
  background: rgba(120, 200, 255, 0.06);
  color: var(--text-dim);
}
.ghost-btn:hover { background: rgba(120, 200, 255, 0.16); color: var(--text); }
.primary-btn {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.3);
}
.primary-btn:hover { filter: brightness(1.1); }

/* ================= 菜单管理弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(3, 9, 18, 0.66);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 120;
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 760px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, #0d2037, #081526);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: 1px; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: none; border-radius: 8px;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.icon-btn:hover { background: rgba(120, 200, 255, 0.14); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.modal-body { padding: 14px 18px; overflow-y: auto; }
.modal-tip { margin: 0 0 12px; font-size: 12px; color: var(--text-mute); line-height: 1.8; }

.cfg-row {
  display: grid;
  grid-template-columns: 34px 1fr 1.6fr 128px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.cfg-row.cfg-sub {
  margin-left: 26px;
  background: rgba(20, 42, 70, 0.4);
  border-left: 2px solid rgba(140, 198, 63, 0.45);
}
.cfg-row.cfg-sub .cfg-name span { font-size: 12.5px; color: var(--text-dim); }

.cfg-row .drag-handle {
  display: grid; place-items: center;
  color: var(--text-mute); cursor: default;
}
.cfg-row .drag-handle svg { width: 16px; height: 16px; }
.cfg-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cfg-name svg { width: 18px; height: 18px; color: var(--green-light); flex: 0 0 18px; }
.cfg-name span { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cfg-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(4, 12, 24, 0.7);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
.cfg-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2); }
.cfg-input::placeholder { color: var(--text-mute); }

.cfg-actions-cell { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.mini-btn {
  height: 28px; min-width: 28px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px;
  background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 12px; font-family: inherit;
}
.mini-btn:hover { background: rgba(120, 200, 255, 0.14); color: var(--text); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px; border-radius: 12px;
  background: rgba(120, 200, 255, 0.16);
  border: 1px solid var(--line);
  position: relative; transition: background .2s;
}
.switch .track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-dim);
  transition: transform .2s, background .2s;
}
.switch input:checked + .track { background: linear-gradient(135deg, var(--green), var(--blue)); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch .switch-label { font-size: 12px; color: var(--text-dim); }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}
.foot-left, .foot-right { display: flex; gap: 8px; }

/* ================= 提示 ================= */
.toast {
  position: fixed;
  left: 50%; bottom: 42px;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 10px;
  background: rgba(12, 30, 52, 0.95);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  z-index: 150;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.toast[hidden] { display: none; }

@media (max-width: 900px) {
  .cfg-row { grid-template-columns: 1fr; }
  .cfg-actions-cell { justify-content: flex-start; }
}
