/* =====================================================================
   Mosavi 基础设施监测平台 · M6 样式
   基准：frontend-design 技能（大胆、生产级、拒绝通用 AI 审美）
   方向：深色石墨蓝 + 冷青强调 + 克制用色（政府监管气质，不要温馨感）
   ===================================================================== */

:root {
  /* ---- 配色（全部收口变量，纪律：强调色只用于关键数据与交互态） ---- */
  --bg:            #0B0F14;   /* 页面底：近黑石墨蓝 */
  --panel:         #151B24;   /* 卡片/面板 */
  --panel-raised:  #1A222D;   /* 浮起层（抽屉/弹窗/悬浮） */
  --border:        #232B36;   /* 分隔边框 */
  --border-strong: #2E3947;
  --text:          #E6EAF0;   /* 主文字 */
  --text-dim:      #8A94A6;   /* 次要文字 */
  --text-faint:    #5B6575;   /* 更弱（占位/禁用） */
  --accent:        #22D3EE;   /* 冷青强调 */
  --accent-dim:    rgba(34, 211, 238, 0.12);
  --ok:            #34D399;   /* 存活 */
  --warn:          #FBBF24;   /* 灰态 */
  --danger:        #F87171;   /* 不可达 / 重要告警 */
  --ok-dim:        rgba(52, 211, 153, 0.12);
  --warn-dim:      rgba(251, 191, 36, 0.12);
  --danger-dim:    rgba(248, 113, 113, 0.12);

  /* ---- 字体（避开 Inter/Roboto/Arial 通用审美） ---- */
  --font-display: "Orbitron", "ZCOOL QingKe HuangYou", sans-serif;  /* 西文数字标题 */
  --font-cn-title: "ZCOOL QingKe HuangYou", "Orbitron", sans-serif; /* 中文标题 */
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 236px;
  --topbar-h: 60px;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(34, 211, 238, 0.25); }

/* 滚动条：窄、低饱和 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3A4757; }
::-webkit-scrollbar-track { background: transparent; }

.boot-splash {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--text-faint); font-family: var(--font-mono);
  letter-spacing: 0.2em;
}

/* =====================================================================
   布局骨架
   ===================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 40;
}

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.14em;
  color: var(--text);
}
.brand-name em { font-style: normal; color: var(--accent); }
.brand-sub {
  font-family: var(--font-cn-title);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.32em;
  margin-top: 4px;
}

.nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  position: relative;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }
.nav-item.active {
  color: var(--text);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.nav-item .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-item .nav-icon svg { width: 16px; height: 16px; }
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #0B0F14;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-foot .u-name { color: var(--text); }
.sidebar-foot .u-role {
  font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: var(--accent-dim); color: var(--accent);
}
.sidebar-foot button { margin-left: auto; }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title {
  font-family: var(--font-cn-title);
  font-size: 19px;
  letter-spacing: 0.08em;
}
.topbar-title .en {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.22em;
  margin-left: 12px;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.bell {
  position: relative;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-dim); cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.bell:hover { color: var(--text); border-color: var(--border-strong); }
.bell .nav-badge { position: absolute; top: -7px; right: -7px; }

.content { padding: 26px 28px 48px; max-width: 1460px; width: 100%; }

/* =====================================================================
   通用组件
   ===================================================================== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-title {
  font-family: var(--font-cn-title);
  font-size: 16px;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.card-title .sub { font-family: var(--font-body); font-size: 12px; color: var(--text-faint); letter-spacing: 0; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-main-side { grid-template-columns: 1fr; }
}

/* ---- 统计大数字 ---- */
.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0.02em;
}
.stat-label { color: var(--text-dim); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat-foot { margin-top: 8px; font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-danger { background: var(--danger); }
.dot-muted { background: var(--text-faint); }

/* ---- 徽标 ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.badge-ok     { background: var(--ok-dim);     color: var(--ok); }
.badge-warn   { background: var(--warn-dim);   color: var(--warn); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-muted  { background: rgba(138, 148, 166, 0.12); color: var(--text-dim); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--border-strong); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06252B; font-weight: 600; }
.btn-primary:hover { background: #4BDDF2; color: #06252B; }
.btn-danger { border-color: rgba(248, 113, 113, 0.4); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-dim); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--accent); border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- 表格 ---- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-faint);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.tbl tbody tr.clickable { cursor: pointer; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.host-cell { font-family: var(--font-mono); color: var(--text); }

/* ---- 表单 ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 120px; resize: vertical; font-family: var(--font-mono); }
.select { font-family: var(--font-body); }
.form-row { display: flex; gap: 12px; }
.form-row > * { flex: 1; }

/* ---- 页签 ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 9px 16px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-family: var(--font-body);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .cnt {
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(138, 148, 166, 0.15); color: var(--text-dim);
  padding: 0 6px; border-radius: 8px;
}
.tab .cnt.hot { background: var(--danger-dim); color: var(--danger); }

/* ---- 告警条（大屏顶部 / 全局） ---- */
.alert-strip {
  display: flex; align-items: center; gap: 12px;
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
}
.alert-strip.warn { background: var(--warn-dim); border-color: rgba(251, 191, 36, 0.35); }
.alert-strip .grow { flex: 1; }
.alert-strip a { color: var(--accent); text-decoration: none; }
.alert-strip a:hover { text-decoration: underline; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(4, 7, 10, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  width: min(560px, calc(100vw - 48px));
  max-height: calc(100vh - 96px);
  display: flex; flex-direction: column;
  animation: riseIn 0.18s ease;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-cn-title);
  font-size: 16px; letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 10px;
}
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } }

/* ---- 抽屉（资产详情） ---- */
.drawer-mask {
  position: fixed; inset: 0;
  background: rgba(4, 7, 10, 0.6);
  z-index: 90;
  animation: fadeIn 0.15s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(760px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--border-strong);
  z-index: 95;
  overflow-y: auto;
  animation: slideIn 0.2s ease;
  padding: 24px 26px 40px;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.drawer-host { font-family: var(--font-mono); font-size: 20px; word-break: break-all; }

/* ---- Toast ---- */
#toast-root { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 13px;
  min-width: 240px; max-width: 420px;
  animation: slideIn 0.18s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }

/* ---- 空态 / 加载 ---- */
.empty {
  padding: 42px 20px; text-align: center;
  color: var(--text-faint); font-size: 13px;
}
.loading { padding: 30px; text-align: center; color: var(--text-faint); font-family: var(--font-mono); }

/* ---- 描述列表 ---- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--text-faint); }
.kv dd { color: var(--text); word-break: break-all; }

/* ---- 图表容器 ---- */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }

/* ---- 工具 ---- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.section-gap { margin-top: 22px; }

/* =====================================================================
   登录页（独立全屏，细微网格纹理——克制的科技感，不堆砌渐变）
   ===================================================================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 500px at 70% -10%, rgba(34, 211, 238, 0.055), transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(35, 43, 54, 0.35) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(35, 43, 54, 0.35) 40px),
    var(--bg);
}
.login-card {
  width: 380px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 38px 36px 32px;
}
.login-brand { text-align: center; margin-bottom: 30px; }
.login-brand .name {
  font-family: var(--font-display);
  font-weight: 800; font-size: 30px; letter-spacing: 0.18em;
}
.login-brand .name em { font-style: normal; color: var(--accent); }
.login-brand .sub {
  font-family: var(--font-cn-title);
  color: var(--text-dim); font-size: 14px; letter-spacing: 0.42em;
  margin-top: 6px; text-indent: 0.42em;
}
.login-brand .en {
  font-family: var(--font-display);
  color: var(--text-faint); font-size: 10px; letter-spacing: 0.3em;
  margin-top: 8px;
}
.login-err {
  background: var(--danger-dim);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px;
  margin-bottom: 14px;
}
.login-btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; margin-top: 4px; }
.login-foot { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 22px; font-family: var(--font-mono); }

/* 登录后的重要告警弹窗（列表项） */
.modal-alert-item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(248, 113, 113, 0.05);
}
.modal-alert-item .t { font-weight: 600; margin-bottom: 3px; }
.modal-alert-item .d { color: var(--text-dim); font-size: 12.5px; word-break: break-all; }
.modal-alert-item .ts { color: var(--text-faint); font-size: 12px; font-family: var(--font-mono); margin-top: 5px; }

/* =====================================================================
   页面细节
   ===================================================================== */
/* 参数配置 */
.param-row { display: grid; grid-template-columns: minmax(220px, 300px) 1fr auto; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--border); align-items: start; }
.param-row:last-child { border-bottom: none; }
.param-key { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
.param-desc { font-size: 12px; color: var(--text-faint); margin-top: 3px; line-height: 1.5; }
.param-meta { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); margin-top: 4px; }
.param-editor { display: flex; gap: 10px; align-items: flex-start; }
.param-editor .input { flex: 1; }
.effect-tag { font-size: 11px; }

/* 任务卡片 */
.task-card { display: flex; flex-direction: column; gap: 10px; }
.task-head { display: flex; align-items: center; gap: 10px; }
.task-name { font-size: 15px; font-weight: 600; }
.task-desc { color: var(--text-faint); font-size: 12.5px; line-height: 1.5; }
.task-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; font-size: 12.5px; }
.task-grid .k { color: var(--text-faint); display: block; font-size: 11.5px; }
.task-runs { margin-top: 6px; }

/* 私钥状态 */
.key-status-active  { color: var(--ok); }
.key-status-standby { color: var(--text-dim); }
.key-status-invalid { color: var(--danger); }

/* 待确认辅助判断数据 */
.verify-note {
  background: rgba(34, 211, 238, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px; color: var(--text-dim);
  line-height: 1.7;
}

/* 审计/系统日志筛选条 */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 150px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; justify-content: flex-end; font-size: 12.5px; color: var(--text-dim); font-family: var(--font-mono); }

/* 活跃统计大数字下的 kind 分布条 */
.kind-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 10px; }
.kind-bar span { display: block; height: 100%; }
.kind-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }
