/* ============================================================
   系统周期评估与安全设备智能管理平台 - 公共样式（双主题）
   深色科技风（默认） / 浅色管理风  CSS 变量驱动
   ============================================================ */
:root {
  --bg: #0b1220;
  --bg-soft: #101a30;
  --card-bg: rgba(17, 26, 46, 0.86);
  --card-border: rgba(62, 84, 140, 0.35);
  --primary: #1e88e5;
  --primary-2: #00b0ff;
  --success: #00e676;
  --warning: #ffd740;
  --danger: #ff5252;
  --text: #e8ecf4;
  --text-2: #9aa8c4;
  --text-3: #5d6b89;
  --sidebar-bg: #0d1526;
  --header-bg: rgba(13, 21, 38, 0.92);
  --hover: rgba(30, 136, 229, 0.12);
  --active: rgba(30, 136, 229, 0.22);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --chart-text: #9aa8c4;
  --input-bg: rgba(10, 16, 30, 0.7);
  --input-border: rgba(62, 84, 140, 0.4);
  --table-head: rgba(30, 136, 229, 0.1);
  --table-stripe: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-soft: #eef2f8;
  --card-bg: #ffffff;
  --card-border: #e3e9f2;
  --primary: #2b6de8;
  --primary-2: #3f8cff;
  --success: #2e9e5b;
  --warning: #d99214;
  --danger: #e5484d;
  --text: #1f2937;
  --text-2: #5b6b81;
  --text-3: #93a1b5;
  --sidebar-bg: #1b2a4a;
  --header-bg: rgba(255, 255, 255, 0.95);
  --hover: rgba(43, 109, 232, 0.08);
  --active: rgba(43, 109, 232, 0.16);
  --shadow: 0 6px 18px rgba(30, 50, 90, 0.1);
  --chart-text: #5b6b81;
  --input-bg: #f7f9fc;
  --input-border: #d4dde9;
  --table-head: rgba(43, 109, 232, 0.07);
  --table-stripe: rgba(0, 0, 0, 0.015);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: background .3s, color .3s;
}
a { color: var(--primary); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--text-3); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  transition: width .25s;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
}
.sidebar.collapsed { width: 60px; }
.side-logo {
  height: 60px; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; color: #fff; font-size: 15px; font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap; overflow: hidden;
}
.side-logo .logo-badge {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
}
.side-menu { flex: 1; overflow-y: auto; padding: 10px 8px; }
.menu-item { margin-bottom: 2px; }
.menu-item > a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 8px; color: var(--text-2);
  font-size: 14px; transition: all .2s; white-space: nowrap;
}
.menu-item > a:hover { background: var(--hover); color: var(--text); }
.menu-item > a.active { background: var(--active); color: var(--primary); font-weight: 600; }
.menu-item .m-icon { width: 18px; text-align: center; flex-shrink: 0; }
.menu-item .arrow { margin-left: auto; font-size: 12px; transition: transform .2s; }
.menu-item.open > a .arrow { transform: rotate(90deg); }
.menu-children { display: none; padding-left: 30px; }
.menu-item.open > .menu-children { display: block; }
.menu-children a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--text-2); font-size: 13px; white-space: nowrap;
}
.menu-children a:hover { color: var(--primary); background: var(--hover); }
.menu-children a.active { color: var(--primary); font-weight: 600; }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .25s; }
.sidebar.collapsed + .main { margin-left: 60px; }

/* ============ 顶栏 ============ */
.header {
  height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--header-bg);
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 90;
  backdrop-filter: blur(8px);
}
.header .h-left { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 34px; height: 34px; border: none; background: transparent;
  color: var(--text-2); border-radius: 8px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--hover); color: var(--primary); }
.rgb-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 12px currentColor; transition: all .4s; }
.rgb-dot.green { background: var(--success); color: var(--success); }
.rgb-dot.yellow { background: var(--warning); color: var(--warning); }
.rgb-dot.red { background: var(--danger); color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.header .env-values { display: flex; gap: 18px; color: var(--text-2); font-size: 13px; }
.header .env-values b { color: var(--text); font-family: Consolas, monospace; }
.header .h-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.header .user-box { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }

/* ============ 内容区 ============ */
.content { flex: 1; padding: 18px 22px; }
.crumb { color: var(--text-3); font-size: 12px; margin-bottom: 14px; }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--primary); }
.crumb .sep { margin: 0 6px; }

/* 模块说明栏 */
.mod-intro {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--card-bg); border: 1px solid var(--card-border);
  margin-bottom: 16px;
}
.mod-intro .mi-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px;
}
.mod-intro .mi-title { font-size: 16px; font-weight: 600; }
.mod-intro .mi-desc { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.mod-intro .mi-more { margin-left: auto; }

/* 卡片 */
.card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.card-title {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.card-title::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--primary); }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 18px; position: relative; overflow: hidden;
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .s-label { color: var(--text-2); font-size: 13px; }
.stat-card .s-value { font-size: 30px; font-weight: 700; margin: 6px 0; font-family: Consolas, monospace; }
.stat-card .s-sub { color: var(--text-3); font-size: 12px; }
.stat-card .s-icon {
  position: absolute; right: 14px; top: 14px; width: 40px; height: 40px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; opacity: .85;
}
.stat-card.blue .s-icon { background: rgba(30, 136, 229, .15); color: var(--primary); }
.stat-card.green .s-icon { background: rgba(0, 230, 118, .12); color: var(--success); }
.stat-card.yellow .s-icon { background: rgba(255, 215, 64, .12); color: var(--warning); }
.stat-card.red .s-icon { background: rgba(255, 82, 82, .12); color: var(--danger); }

/* 网格布局 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
@media (max-width: 1200px) { .grid-2, .grid-3, .grid-4, .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; } }

/* 图表容器 */
.chart { width: 100%; height: 300px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  background: var(--table-head); color: var(--text-2); text-align: left;
  padding: 10px 12px; font-weight: 600; white-space: nowrap;
}
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--card-border); }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:nth-child(even) { background: var(--table-stripe); }

/* 标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; }
.tag.green { background: rgba(0, 230, 118, .12); color: var(--success); }
.tag.yellow { background: rgba(255, 215, 64, .14); color: var(--warning); }
.tag.red { background: rgba(255, 82, 82, .14); color: var(--danger); }
.tag.blue { background: rgba(30, 136, 229, .13); color: var(--primary); }
.tag.gray { background: rgba(120, 140, 170, .15); color: var(--text-2); }
.tag.orange { background: rgba(255, 152, 0, .15); color: #ff9800; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: all .2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #333; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-default { background: var(--input-bg); color: var(--text); border-color: var(--input-border); }
.btn-default:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
.form-item { margin-bottom: 14px; }
.form-item label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.form-item .required::after { content: ' *'; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--input-border); background: var(--input-bg);
  color: var(--text); font-size: 14px; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.select { appearance: auto; }
.input[type="checkbox"] { width: auto; }

/* 筛选栏 */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  padding: 14px 16px; margin-bottom: 16px;
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; }

/* 分页 */
.pagination { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 0 0; }
.pagination a, .pagination span {
  padding: 5px 12px; border-radius: 6px; border: 1px solid var(--card-border);
  color: var(--text-2); font-size: 13px;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Toast */
#toast-box { position: fixed; top: 70px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 220px; padding: 12px 16px; border-radius: 10px;
  background: var(--card-bg); border: 1px solid var(--card-border);
  box-shadow: var(--shadow); color: var(--text); font-size: 14px;
  display: flex; align-items: center; gap: 8px; animation: slideIn .3s;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 1000;
  display: flex; align-items: center; justify-content: center; animation: fadeIn .2s;
}
.modal {
  width: 520px; max-width: 92vw; max-height: 86vh; overflow-y: auto;
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { cursor: pointer; color: var(--text-3); font-size: 18px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 告警弹窗 */
.alert-modal {
  width: 460px; border-radius: 14px; overflow: hidden; animation: popIn .35s;
}
.alert-modal .am-head { padding: 20px 22px; display: flex; align-items: center; gap: 14px; }
.alert-modal.warning .am-head { background: linear-gradient(135deg, #ffd740, #ffb300); color: #3a2e00; }
.alert-modal.high .am-head { background: linear-gradient(135deg, #ff5252, #e53935); color: #fff; }
.alert-modal .am-icon { font-size: 34px; }
.alert-modal .am-title { font-size: 17px; font-weight: 700; }
.alert-modal .am-body { padding: 16px 22px; color: var(--text); }
.alert-modal .am-body .content { color: var(--text-2); margin: 8px 0; }
.alert-modal .am-foot { padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.alert-modal.high .am-body { border: 1px solid var(--card-border); border-top: none; }
@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* 大屏 */
.screen-body { background: #050a14; color: #e8ecf4; overflow: hidden; }
.screen-layout { display: flex; flex-direction: column; height: 100vh; }
.screen-header { height: 64px; display: flex; align-items: center; justify-content: center; position: relative; }
.screen-title { font-size: 28px; font-weight: 700; letter-spacing: 6px; background: linear-gradient(90deg, #1e88e5, #00e5ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.screen-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); gap: 14px; padding: 0 20px 20px; }
.screen-card { background: rgba(17, 26, 46, .8); border: 1px solid rgba(62, 84, 140, .4); border-radius: 12px; padding: 16px; }
.screen-card .sc-title { font-size: 16px; color: #9aa8c4; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.screen-card .sc-title::before { content: ''; width: 4px; height: 14px; background: #1e88e5; border-radius: 2px; }
.screen-kpi { font-size: 42px; font-weight: 700; font-family: Consolas, monospace; }
.screen-corner { position: fixed; right: 20px; bottom: 16px; font-size: 13px; color: #5d6b89; z-index: 10; text-align: right; }

/* 登录页 */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 20% 10%, #12305e 0%, #0b1220 55%, #070d18 100%);
  position: relative; overflow: hidden;
}
.login-body::before {
  content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 136, 229, .18), transparent 70%);
  top: -120px; right: -80px;
}
.login-card {
  width: 400px; background: rgba(15, 24, 44, .92); border: 1px solid rgba(62, 84, 140, .4);
  border-radius: 16px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
  z-index: 2;
}
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.login-logo .badge { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #1e88e5, #00b0ff); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 700; }
.login-title { text-align: center; color: #e8ecf4; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-sub { text-align: center; color: #5d6b89; font-size: 12px; margin-bottom: 28px; }
.login-card .input { background: rgba(8, 13, 26, .7); border-color: rgba(62, 84, 140, .45); color: #e8ecf4; }
.login-card .form-item label { color: #9aa8c4; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row .input { flex: 1; }
.captcha-row img { height: 38px; border-radius: 8px; cursor: pointer; border: 1px solid rgba(62, 84, 140, .4); }
.login-links { display: flex; justify-content: space-between; margin-top: 14px; font-size: 13px; }
.login-btn { width: 100%; padding: 11px; margin-top: 8px; font-size: 15px; }
.login-footer { text-align: center; color: #5d6b89; font-size: 12px; margin-top: 26px; }

/* 空状态 */
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }
.empty .e-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }

/* 进度条 */
.progress-wrap { background: var(--input-bg); border-radius: 8px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 8px; transition: width .4s; }
.progress-bar.success { background: var(--success); }

/* 步骤条 */
.steps { display: flex; align-items: center; gap: 0; margin: 10px 0 18px; }
.step { flex: 1; text-align: center; position: relative; color: var(--text-3); font-size: 13px; }
.step .dot { width: 28px; height: 28px; margin: 0 auto 6px; border-radius: 50%; background: var(--input-bg); border: 2px solid var(--input-border); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.step.active { color: var(--primary); }
.step.active .dot { border-color: var(--primary); color: var(--primary); }
.step.done { color: var(--success); }
.step.done .dot { border-color: var(--success); background: rgba(0, 230, 118, .1); color: var(--success); }

/* 其他 */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-3); }
.text-lg { font-size: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.footer { padding: 14px 22px; color: var(--text-3); font-size: 12px; text-align: center; border-top: 1px solid var(--card-border); }

/* ---------- 补充：表单/提示框/勾选标签 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr; } }
.modal-body { font-size: 13px; line-height: 1.7; }
.alert-box { padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.7; }
.alert-box.green { background: rgba(0, 230, 118, .1); border: 1px solid rgba(0, 230, 118, .3); color: var(--success); }
.alert-box.yellow { background: rgba(255, 215, 64, .1); border: 1px solid rgba(255, 215, 64, .3); color: var(--warning); }
.alert-box.red { background: rgba(255, 82, 82, .12); border: 1px solid rgba(255, 82, 82, .35); color: var(--danger); }
.chk-label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--card-border); border-radius: 8px; cursor: pointer; font-size: 13px; }
.chk-label input { accent-color: var(--primary); }
.mb-8 { margin-bottom: 8px; }
