:root {
  --mi-blue: #1d79d9;
  --mi-blue-hover: #1668bd;
  --bg-color: #1d79d9;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-sub: #888888;
  --border-color: #e5e5e5;
  --btn-bg: #3b82f6; 
  --btn-hover: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.top-header { background-color: var(--mi-blue); color: #fff; height: 60px; }
.header-inner { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; align-items: center; padding: 0 15px; overflow-x: auto; }
.logo { font-size: 22px; font-weight: 300; letter-spacing: 1px; margin-right: 15px; flex-shrink: 0; }
.main-nav { display: flex; height: 100%; flex-shrink: 0; }
.main-nav a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 0 12px; display: flex; align-items: center; font-size: 14px; transition: color 0.2s; cursor: pointer; }
.main-nav a:hover, .main-nav a.active { color: #fff; font-weight: bold; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; flex-shrink: 0; padding-left: 15px; }

/* 二级导航 (彻底修复显示不全问题) */
.sub-header { background-color: var(--mi-blue); padding: 15px 0; position: relative; z-index: 10; }
.sub-nav-inner { 
  display: flex; 
  justify-content: space-around; /* 自动均匀分配宽度 */
  width: 100%; 
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5px;
}
.sub-nav-item { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  cursor: pointer; 
  color: #fff; 
  position: relative; 
  flex: 1; /* 等分剩余空间 */
  max-width: 100px; /* 防止在大屏上拉得太开 */
}
.sub-nav-icon { 
  width: 46px; height: 46px; 
  border-radius: 50%; 
  display: flex; align-items: center; justify-content: center; 
  font-size: 22px; 
  margin-bottom: 6px; 
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); 
  flex-shrink: 0;
  transition: transform 0.2s;
}
.sub-nav-item:active .sub-nav-icon {
  transform: scale(0.95);
}
.sub-nav-text { 
  font-size: 12px; 
  opacity: 0.9; 
  text-align: center; 
  line-height: 1.2; 
  white-space: nowrap; /* 保证文字不换行 */
}
.sub-nav-item.active .sub-nav-icon { 
  box-shadow: 0 0 0 3px rgba(255,255,255,0.6); 
}
.sub-nav-item.active .sub-nav-text { 
  opacity: 1; 
  font-weight: bold; 
}
.sub-nav-item.active::after { 
  content: ''; 
  position: absolute; 
  bottom: -15px; 
  left: 50%; 
  transform: translateX(-50%); 
  border-width: 8px; 
  border-style: solid; 
  border-color: transparent transparent #fff transparent; 
}

/* 主内容区 */
.main-content { flex: 1; max-width: 1200px; margin: 0 auto; width: 100%; padding: 0 15px 40px; position: relative; }

/* 卡片样式 */
.card { background: var(--card-bg); border-radius: 8px; padding: 20px; margin-bottom: 15px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); overflow: hidden; }
.card-title { font-size: 15px; font-weight: bold; color: var(--mi-blue); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.section-title { font-size: 14px; font-weight: bold; color: #333; margin: 15px 0 10px; }

/* 常规水平表单 */
.form-group { display: flex; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.form-label { width: 90px; color: #666; font-size: 13px; flex-shrink: 0; }

/* 密码/垂直表单 (针对安全中心) */
.pwd-form-group { display: flex; flex-direction: column; margin-bottom: 15px; }
.pwd-form-group .form-label { margin-bottom: 8px; font-size: 14px; color: #333; font-weight: bold; width: 100%; }

.form-control { border: 1px solid var(--border-color); border-radius: 4px; padding: 8px 12px; font-size: 13px; color: #333; outline: none; width: 100%; max-width: 260px; background: #fff; }
.form-control:focus { border-color: var(--mi-blue); }
.form-control-full { max-width: 100%; }
select.form-control { appearance: none; -webkit-appearance: none; background: url('data:image/svg+xml;utf8,<svg fill="%23999" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>') no-repeat right 8px center; padding-right: 30px; }

.help-text { font-size: 12px; color: #999; margin-top: 5px; margin-left: 90px; }
input[type="radio"], input[type="checkbox"] { vertical-align: middle; margin-right: 4px; margin-top: -2px; cursor: pointer; }

/* 开关按钮 */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--mi-blue); }
input:checked + .slider:before { transform: translateX(20px); }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 5px; }
.data-table th { text-align: left; padding: 10px 8px; color: #666; font-weight: normal; border-bottom: 1px solid var(--border-color); }
.data-table td { padding: 10px 8px; border-bottom: 1px solid var(--border-color); }
.empty-state { text-align: center; padding: 25px; color: #999; font-size: 13px; border-bottom: 1px solid var(--border-color); }

/* 按钮 */
.btn { background: var(--btn-bg); color: white; border: none; padding: 8px 16px; border-radius: 4px; cursor: pointer; font-size: 13px; transition: 0.2s; white-space: nowrap; display: inline-block; text-align: center; }
.btn:hover { background: var(--btn-hover); }
.btn-outline { background: white; color: #333; border: 1px solid #ccc; }
.btn-outline:hover { background: #f5f5f5; }
.btn + .btn { margin-left: 5px; }
.btn-block { display: block; width: 100%; padding: 10px 0; font-size: 14px; }

/* MAC 克隆专用布局 */
.mac-clone-group { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; width: 100%; }
.mac-clone-group .form-control { flex: 1; width: 0; max-width: none; }
.mac-btn-group { display: flex; gap: 5px; flex-shrink: 0; }

/* IP 输入组合 */
.ip-input-group { display: flex; align-items: center; gap: 4px; }
.ip-input-group .form-control { width: 120px; }

/* 弹窗模态框 */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 15px;}
.modal-content { background: #fff; border-radius: 8px; width: 100%; max-width: 420px; padding: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.modal-header { font-size: 15px; font-weight: bold; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { cursor: pointer; color: #999; font-size: 22px; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-body .form-group { margin-bottom: 10px; }
.modal-body .form-control { width: 100%; max-width: 100%; }
.modal-footer { margin-top: 20px; text-align: center; }

/* 网格排版 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; gap: 10px; } }

.footer { text-align: center; color: rgba(255,255,255,0.6); font-size: 12px; padding: 15px 0 30px; line-height: 1.8; }