/* ============================================================
   网络威胁安全运营系统 · 设计稿还原
   TDesign 令牌体系 (Light + SOC Dark)
   ============================================================ */

:root {
  /* ---- Color (Light) ---- */
  --bg-page: #ededed;
  --bg-container: #ffffff;
  --bg-container-hover: #f2f2f2;
  --bg-component: #e8e8e8;
  --text-primary: #18191c;
  --text-secondary: #5e5e5e;
  --text-placeholder: #8a8a8a;
  --brand: #0052d9;
  --brand-hover: #366ef5;
  --brand-light: #f2f3ff;
  --warning: #e37318;
  --error: #d54941;
  --success: #2ba471;
  --border: #dedede;
  --stroke: #e8e8e8;

  /* ---- Severity ---- */
  --sev-critical: #d54941;
  --sev-high: #e37318;
  --sev-medium: #ebb000;
  --sev-low: #0052d9;
  --sev-info: #8c8c8c;

  /* ---- SOC Dark (Ops) ---- */
  --soc-bg: #0b0d12;
  --soc-panel: #1c212e;
  --soc-panel-alt: #242b3b;
  --soc-border: #2e3847;
  --soc-accent: #4582e6;
  --soc-cyan: #21c9db;
  --soc-text-1: rgba(255, 255, 255, 0.9);
  --soc-text-2: rgba(255, 255, 255, 0.55);
  --soc-text-3: rgba(255, 255, 255, 0.35);

  /* ---- Size ---- */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 6px;
  --radius-xl: 9px;
  --radius-2xl: 12px;

  --sidebar-w: 220px;
  --topbar-h: 56px;
}

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

html, body { height: 100%; }

body {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--bg-page);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.font-num { font-family: "Inter", "Noto Sans SC", sans-serif; }

/* ============================================================
   App Shell
   ============================================================ */
#app { height: 100vh; }

.shell { display: flex; height: 100vh; width: 100vw; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-container);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.brand-row {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--stroke);
}
.brand-row .shield { width: 26px; height: 26px; flex: none; }
.brand-name { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.nav-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}
.nav-group-label {
  padding: 14px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-placeholder);
  letter-spacing: 0.5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  user-select: none;
}
.nav-item .ico { width: 20px; height: 20px; flex: none; color: var(--text-secondary); }
.nav-item:hover { background: var(--bg-container-hover); }
.nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 500; }
.nav-item.active .ico { color: var(--brand); }

.sidebar-footer { border-top: 1px solid var(--stroke); }
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 64px;
  padding: 0 16px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: none;
}
.user-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.user-role { font-size: 12px; color: var(--text-placeholder); }

/* ---- Main column ---- */
.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }

.topbar {
  height: var(--topbar-h);
  background: var(--bg-container);
  border-bottom: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex: none;
}
.topbar-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.topbar-tools { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--bg-container-hover); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px; width: 7px; height: 7px;
  border-radius: 999px; background: var(--error); border: 1.5px solid #fff;
}
.topbar-user { font-size: 14px; color: var(--text-primary); }

.scroll-content {
  flex: 1; overflow-y: auto;
  padding: 24px;
  display: flex; flex-direction: column; gap: 24px;
  background: var(--bg-page);
}

/* ============================================================
   Generic components
   ============================================================ */
.panel {
  background: var(--bg-container);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.panel-pad { padding: 20px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 40px;
}
.section-header .title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.section-header .link { font-size: 14px; color: var(--brand); cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer; border: none;
  font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-container-hover); }

select, input { font-family: inherit; }

/* Tag / severity */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
}
.tag-critical { background: rgba(213,73,65,0.12); color: var(--error); }
.tag-high { background: rgba(227,115,24,0.12); color: var(--warning); }
.tag-medium { background: rgba(235,176,0,0.15); color: #b98600; }
.tag-low { background: rgba(0,82,217,0.10); color: var(--brand); }
.tag-info { background: rgba(140,140,140,0.12); color: var(--sev-info); }
.tag-success { background: rgba(43,164,113,0.12); color: var(--success); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  text-align: left; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  background: #f2f2f2; height: 40px; padding: 0 12px;
}
.tbl tbody td {
  font-size: 13px; color: var(--text-primary); height: 48px; padding: 0 12px;
  border-bottom: 1px solid var(--stroke);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { font-family: "Inter", sans-serif; }

/* Stat cards */
.stat-row { display: flex; gap: 16px; }
.stat-card {
  flex: 1; background: var(--bg-container); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 8px;
}
.stat-card .label { font-size: 14px; color: var(--text-secondary); }
.stat-card .value { font-size: 28px; font-weight: 600; font-family: "Inter", sans-serif; color: var(--text-primary); }
.stat-card .sub { font-size: 12px; color: var(--text-placeholder); }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: 16px; background: var(--bg-container);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 12px; height: 52px;
}
.filter-bar .flabel { font-size: 13px; color: var(--text-secondary); }
.selector {
  display: flex; align-items: center; gap: 8px; background: var(--bg-component);
  border-radius: var(--radius-md); height: 32px; padding: 0 10px; font-size: 13px; color: var(--text-primary);
}

/* Tabs */
.tabs { display: flex; gap: 8px; }
.tab {
  height: 36px; padding: 0 16px; border-radius: var(--radius-md);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 14px; color: var(--text-secondary); background: var(--bg-container);
  border: 1px solid var(--border);
}
.tab.active { color: var(--brand); background: var(--brand-light); border-color: transparent; font-weight: 500; }
.tab .count {
  font-family: "Inter", sans-serif; font-size: 12px; padding: 0 6px; height: 18px;
  display: inline-flex; align-items: center; border-radius: 999px;
  background: var(--bg-component); color: var(--text-secondary);
}
.tab.active .count { background: rgba(0,82,217,0.15); color: var(--brand); }

/* Bar list */
.bar-row { display: flex; align-items: center; gap: 12px; height: 32px; }
.bar-row .blabel { width: 130px; font-size: 13px; color: var(--text-secondary); }
.bar-track { flex: 1; height: 8px; background: var(--bg-component); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 8px; border-radius: 999px; }
.bar-row .bval { width: 48px; text-align: right; font-size: 13px; font-family: "Inter", sans-serif; color: var(--text-primary); }

/* Screens visibility */
.screen { display: none; }
.screen.active { display: flex; }

/* ============================================================
   Login (07)
   ============================================================ */
.login {
  display: none; height: 100vh; width: 100vw;
}
.login.active { display: flex; }
.login .left {
  width: 560px; flex: none; height: 100%;
  background: linear-gradient(135deg, #0a2515 0%, #0052d9 100%);
  padding: 56px 48px 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login .brand-row2 { display: flex; align-items: center; gap: 10px; }
.login .brand-row2 .bname { font-size: 20px; font-weight: 600; color: #fff; }
.login .mid { display: flex; flex-direction: column; gap: 16px; }
.login .tagline { font-size: 36px; font-weight: 700; color: #fff; line-height: 1.25; }
.login .sub { font-size: 14px; color: #c9d6f0; max-width: 464px; line-height: 1.7; }
.login .feat { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.login .feat .f { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #c9d6f0; }
.login .feat .f .d { width: 6px; height: 6px; border-radius: 999px; background: #4b8bff; }
.login .copy { font-size: 12px; color: #8fa8d8; }

.login .right { flex: 1; height: 100%; background: #eef1f5; display: flex; align-items: center; justify-content: center; }
.login-card { width: 400px; background: #fff; border: 1px solid #dedede; border-radius: var(--radius-2xl); padding: 40px; display: flex; flex-direction: column; gap: 20px; }
.login-card .ct { font-size: 20px; font-weight: 700; color: #18191c; }
.login-card .cs { font-size: 13px; color: #8a8a8a; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .flabel { font-size: 13px; color: #5e5e5e; }
.input {
  width: 100%; height: 44px; background: #f3f3f3; border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 0 12px; font-size: 14px; color: #18191c;
}
.input::placeholder { color: #8a8a8a; }
.input:focus { outline: none; border-color: var(--brand); background: #fff; }
.login-btn { width: 100%; height: 44px; background: var(--brand); color: #fff; border: none; border-radius: var(--radius-md); font-size: 15px; font-weight: 600; cursor: pointer; }
.login-btn:hover { background: var(--brand-hover); }

/* ============================================================
   SOC Big Screen (01)
   ============================================================ */
.soc {
  display: none; flex-direction: column; height: 100vh; width: 100vw;
  background: var(--soc-bg); overflow: hidden;
}
.soc.active { display: flex; }
.soc-header {
  height: 80px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 40px;
}
.soc-header .time { font-size: 14px; font-family: "Inter", sans-serif; color: var(--soc-text-3); }
.soc-header .title { font-size: 32px; font-weight: 700; color: var(--soc-text-1); letter-spacing: 4px; }
.soc-header .org { font-size: 14px; color: var(--soc-text-3); }

.soc-kpis { display: flex; gap: 24px; padding: 0 40px; height: 120px; flex: none; }
.soc-kpi {
  flex: 1; background: var(--soc-panel); border: 1px solid var(--soc-border); border-radius: var(--radius-lg);
  padding: 18px 20px; display: flex; flex-direction: column; justify-content: space-between;
}
.soc-kpi .kl { font-size: 14px; color: var(--soc-text-2); }
.soc-kpi .kv { font-size: 34px; font-weight: 700; font-family: "Inter", sans-serif; color: #fff; }
.soc-kpi .kv.cyan { color: var(--soc-cyan); }
.soc-kpi .kv.warn { color: var(--warning); }
.soc-kpi .kv.brand { color: var(--soc-accent); }

.soc-body { flex: 1; display: flex; gap: 24px; padding: 40px; min-height: 0; }
.soc-map {
  flex: 1; background: var(--soc-panel); border: 1px solid var(--soc-border); border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
}
.soc-map .map-title { position: absolute; top: 16px; left: 20px; font-size: 15px; color: var(--soc-text-1); font-weight: 600; }
.soc-map .legend { position: absolute; bottom: 16px; left: 20px; display: flex; gap: 18px; }
.soc-map .legend .li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--soc-text-2); }
.soc-map .legend .dot { width: 8px; height: 8px; border-radius: 999px; }
.soc-side { width: 520px; flex: none; display: flex; flex-direction: column; gap: 24px; min-height: 0; }
.soc-panel { background: var(--soc-panel); border: 1px solid var(--soc-border); border-radius: var(--radius-lg); padding: 18px 20px; }
.soc-panel .ph { font-size: 15px; color: var(--soc-text-1); font-weight: 600; margin-bottom: 14px; }
.soc-panel .ev { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--soc-border); }
.soc-panel .ev:last-child { border-bottom: none; }
.soc-panel .ev .eico { width: 30px; height: 30px; border-radius: var(--radius-md); background: var(--soc-panel-alt); display: flex; align-items: center; justify-content: center; flex: none; }
.soc-panel .ev .et { flex: 1; min-width: 0; }
.soc-panel .ev .et .t1 { font-size: 13px; color: var(--soc-text-1); }
.soc-panel .ev .et .t2 { font-size: 12px; color: var(--soc-text-3); font-family: "Inter", sans-serif; }
.soc-panel .ev .etime { font-size: 12px; color: var(--soc-text-3); font-family: "Inter", sans-serif; }
.soc-feed { flex: 1; overflow: hidden; }
.soc-feed .fi { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soc-border); align-items: flex-start; }
.soc-feed .fi .badge { font-size: 11px; padding: 1px 6px; border-radius: 3px; font-family: "Inter", sans-serif; flex: none; }
.soc-feed .fi .ft { font-size: 13px; color: var(--soc-text-2); line-height: 1.5; }

@keyframes dash { to { stroke-dashoffset: -1000; } }
@keyframes pulse { 0%,100% { r: 4; opacity: 1; } 50% { r: 7; opacity: 0.5; } }
.attack-line { stroke-dasharray: 6 8; animation: dash 18s linear infinite; }
.pulse-pt { animation: pulse 1.8s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Report (06)
   ============================================================ */
.report-grid { display: flex; gap: 24px; align-items: flex-start; }
.report-grid .col { flex: 1; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.gauge-wrap { display: flex; align-items: center; gap: 24px; }
.dim-bars { display: flex; flex-direction: column; gap: 14px; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; height: 64px;
  background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0 20px;
}
.toolbar .tt { font-size: 18px; font-weight: 600; }
.toolbar .ts { font-size: 12px; color: var(--text-placeholder); margin-top: 2px; }
.hint-bar {
  display: flex; align-items: center; gap: 10px; background: #e8f0fe; border-radius: var(--radius-lg);
  padding: 12px; font-size: 13px; color: var(--brand);
}
.url-chip { border: 1px solid var(--brand); border-radius: var(--radius-md); padding: 0 10px; height: 28px; display: inline-flex; align-items: center; font-family: "Inter", sans-serif; font-size: 13px; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 48px; text-align: center;
  background: var(--bg-container); transition: border-color .2s, background .2s;
}
.upload-zone.drag { border-color: var(--brand); background: var(--brand-light); }
.upload-zone .uz-ico { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--brand); }
.upload-zone .uz-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.upload-zone .uz-sub { font-size: 13px; color: var(--text-placeholder); margin-bottom: 20px; }

.field-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.field-list .fi { display: flex; gap: 8px; font-size: 13px; padding: 4px 0; }
.field-list .fi .fn { color: var(--text-primary); font-family: "Inter", sans-serif; }
.field-list .fi .ft { color: var(--text-placeholder); }
.field-list .fi .req { color: var(--error); }

.empty-state { text-align: center; padding: 80px 20px; color: var(--text-placeholder); }
.empty-state .es-ico { font-size: 40px; margin-bottom: 12px; }

.placeholder-body { display: flex; flex-direction: column; gap: 24px; }

/* ============================================================
   Persistence / interaction support
   ============================================================ */
select.selector { appearance: none; -webkit-appearance: none; border: none; cursor: pointer; min-width: 120px; }
.topbar-user { cursor: pointer; user-select: none; }
.refresh-time { font-size: 12px; color: var(--text-placeholder); font-family: "Inter", sans-serif; }

/* Stat card drag */
.stat-card[draggable="true"] { cursor: grab; }
.stat-card.dragging { opacity: .4; }
.stat-card .drag-hint { font-size: 11px; color: var(--text-placeholder); }

/* Import records */
.imp-list { display: flex; flex-direction: column; gap: 10px; }
.imp-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-page); }
.imp-ico { font-size: 22px; }
.imp-meta { flex: 1; }
.imp-name { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.imp-sub { font-size: 12px; color: var(--text-placeholder); }
.imp-empty { font-size: 13px; color: var(--text-placeholder); padding: 16px 0; }
.icon-x { width: 24px; height: 24px; border-radius: var(--radius-sm); border: none; background: transparent; color: var(--text-placeholder); cursor: pointer; font-size: 13px; }
.icon-x:hover { background: var(--bg-container-hover); color: var(--error); }

/* Badge (import ok / generic) */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; }
.tag-ok { background: rgba(43,164,113,0.12); color: var(--success); }
.tag-err { background: rgba(213,73,65,0.12); color: var(--error); }

.ds-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.ds-tab { padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer; background: var(--bg-container); color: var(--text-secondary); }
.ds-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.field-list .fi .enum { color: var(--text-placeholder); font-size: 11px; margin-left: 4px; }
.tbl-wrap { max-height: 440px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }

/* Toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); opacity: 0; pointer-events: none; padding: 10px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; color: #fff; background: var(--text-primary); transition: all .25s; z-index: 9999; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--brand); }

/* Inline form (response / license new entries) */
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; background: var(--bg-page); border: 1px dashed var(--border); border-radius: var(--radius-md); margin-bottom: 16px; }
.inline-form input, .inline-form select { height: 36px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 10px; font-size: 13px; background: #fff; min-width: 150px; }
.actions-cell { color: var(--brand); cursor: pointer; }
.pwd-cell { color: var(--brand); cursor: pointer; }

/* Settings rows */
.set-row { display: flex; align-items: center; justify-content: space-between; height: 52px; border-bottom: 1px solid var(--stroke); }
.set-row:last-child { border-bottom: none; }
.set-row .sl { font-size: 14px; color: var(--text-primary); }
.set-row .ss { font-size: 12px; color: var(--text-placeholder); margin-top: 2px; }
.set-group-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 4px 0 8px; }

