/* ============================================================
 *  中间件日志分析 —— 复用全站设计变量
 * ============================================================ */
.log-wrap { position: relative; }

/* ── 载入区 ── */
.log-drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-surface);
  padding: var(--space-2xl);
  text-align: center;
  transition: background var(--transition), border-color var(--transition);
}
.log-drop.is-over { border-color: var(--text-heading); background: var(--bg-surface-hover); }
.log-drop__title { font-family: var(--font-heading); font-size: 16px; font-weight: 700; color: var(--text-heading); }
.log-drop__sub { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 14px; line-height: 1.6; }

/* ── 进度 ── */
.log-progress { margin-top: var(--space-md); }
.log-progress__track { height: 6px; background: var(--bg-code); border-radius: 4px; overflow: hidden; }
.log-progress__bar { height: 100%; width: 0; background: var(--text-heading); transition: width 120ms linear; }
.log-progress__text { font-size: 12px; color: var(--text-secondary); margin-top: 8px; font-family: var(--font-mono); }

/* ── 仪表盘 ── */
.log-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-sm); margin-bottom: var(--space-lg); }
.log-card { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(160deg, var(--bg-surface), var(--bg-body)); padding: var(--space-md); }
.log-card--wide { grid-column: span 2; }
.log-card__v { font-family: var(--font-heading); font-size: 20px; font-weight: 700; color: var(--text-heading); line-height: 1.2; word-break: break-all; }
.log-card__l { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.log-card--accent .log-card__v { color: var(--severity-critical); }

.log-dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-lg); margin-bottom: var(--space-lg); }
.log-panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-surface); padding: var(--space-md) var(--space-lg); }
.log-panel__title { font-size: 12px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; }
.log-panel__title--gap { margin-top: 16px; }

.log-statusbar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--bg-code); }
.log-seg { height: 100%; }
.log-seg--2xx { background: var(--severity-low); } .log-seg--3xx { background: var(--severity-info); }
.log-seg--4xx { background: var(--severity-medium); } .log-seg--5xx { background: var(--severity-critical); }
.log-seg--other { background: var(--text-ghost); }
.log-statuslegend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 11.5px; color: var(--text-secondary); }
.log-leg { display: inline-flex; align-items: center; gap: 5px; }
.log-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.log-trend { width: 100%; height: 80px; display: block; margin-top: 8px; }

.log-risklist { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.log-riskitem { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); padding: 3px 0; border-bottom: 1px solid var(--border); }
.log-riskitem.is-hit { color: var(--text-heading); }
.log-riskitem.is-hit b { color: var(--severity-critical); }

.log-tops { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); margin-bottom: var(--space-lg); }
.log-toprow { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; border-radius: var(--radius); overflow: hidden; }
.log-toprow:hover { background: var(--bg-surface-hover); }
.log-topbar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--severity-info-bg); z-index: 0; }
.log-topkey { position: relative; z-index: 1; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); color: var(--text-heading); }
.log-topcnt { position: relative; z-index: 1; font-family: var(--font-mono); color: var(--text-muted); }

/* ── 筛选：快速条件 + 高级查询 ── */
.log-filter { margin-bottom: var(--space-sm); }
.log-simple {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm);
}
.log-simple__label {
  font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap;
}
.log-simple .tool-select, .log-simple .tool-input { width: auto; min-width: 96px; padding: 7px 10px; margin: 0; }
.log-simple #log-sf-field { min-width: 108px; }
.log-simple #log-sf-op { min-width: 88px; }
.log-simple .log-sf-val { min-width: 140px; flex: 1 1 140px; }
.log-simple .log-sf-val-select { min-width: 140px; flex: 1 1 140px; }
.log-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.log-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-family: var(--font-mono); color: var(--text-heading);
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 8px 4px 10px; line-height: 1.3;
}
.log-chip__x {
  border: none; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.log-chip__x:hover { color: var(--severity-critical); }

/* ── 工具条（筛选） ── */
.log-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.log-toolbar .tool-input, .log-toolbar .tool-select { width: auto; padding: 7px 10px; margin: 0; }
.log-toolbar .log-q { min-width: 220px; flex: 1 1 220px; }
.log-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
#log-syntax { margin: 0 0 var(--space-sm); }
#log-syntax code { font-family: var(--font-mono); font-size: 11px; background: var(--bg-code); color: var(--text-heading); padding: 1px 5px; border-radius: 3px; }
.log-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-left: auto; }
.log-export { display: inline-flex; align-items: center; gap: 6px; }
.log-export__label { font-size: 12px; color: var(--text-secondary); }

/* ── 虚拟滚动表格 ── */
.lt {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-surface);
  /* 列宽用 CSS 变量驱动，便于拖拽调整（通过 CSSOM 设置，规避 CSP 内联 style 限制） */
  --lt-cols: 56px 152px 134px 60px 60px 78px minmax(180px, 1fr) 168px;
  /* 右侧详情侧栏占用宽度：关闭为 0，打开时取 --lt-side-w（由 JS 写入，拖拽可调） */
  --lt-side: 0px;
}
.lt.is-side-open { --lt-side: var(--lt-side-w, 420px); }

/* ── VSCode 风格查找浮层（Ctrl+F） ── */
.lt-find {
  position: absolute; top: 6px; right: calc(22px + var(--lt-side)); z-index: 25;
  transition: right 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 4px 6px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}
.lt-find[hidden] { display: none; }

/* ── 右侧概览缩略图（minimap）：低调克制，紧贴右缘 ── */
.lt-map {
  position: absolute; top: 34px; right: var(--lt-side); width: 60px; height: 540px;
  z-index: 2; cursor: pointer; display: block;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  transition: right 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.lt-viewport { margin-right: calc(60px + var(--lt-side)); transition: margin-right 0.28s cubic-bezier(0.22, 0.61, 0.36, 1); }
.lt-head { margin-right: calc(60px + var(--lt-side)); position: relative; transition: margin-right 0.28s cubic-bezier(0.22, 0.61, 0.36, 1); }
/* 拖拽调宽时关闭过渡，跟手不拖影 */
.lt.lt--side-drag .lt-find,
.lt.lt--side-drag .lt-map,
.lt.lt--side-drag .lt-viewport,
.lt.lt--side-drag .lt-head,
.lt.lt--side-drag .lt-side { transition: none; }
/* 补齐表头右侧（minimap 上方）让出的空白，延续表头背景与下边框 */
.lt-head::after {
  content: ''; position: absolute; top: 0; bottom: 0; right: -60px; width: 60px;
  background: var(--bg-surface-hover);
  border-bottom: 1px solid var(--border);
}
.lt-find__input {
  width: 210px; border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-code); color: var(--text-heading);
  font-family: var(--font-mono); font-size: 12px; padding: 5px 8px; outline: none;
}
.lt-find__input:focus { border-color: var(--border-strong); }
.lt-find__count {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
  min-width: 60px; text-align: center; white-space: nowrap;
}
.lt-find__count.is-empty { color: var(--severity-critical); }
.lt-find__btn, .lt-find__opt {
  border: 1px solid transparent; background: none; color: var(--text-secondary);
  cursor: pointer; border-radius: 4px; padding: 3px 7px; font-size: 13px; line-height: 1;
}
.lt-find__btn:hover, .lt-find__opt:hover { background: var(--bg-surface-hover); color: var(--text-heading); }
.lt-find__opt { font-family: var(--font-mono); font-weight: 700; font-size: 11px; }
.lt-find__opt.is-on { background: var(--text-heading); color: var(--bg-surface); border-color: var(--text-heading); }

/* ── 命中高亮 ── */
.lt-hl { background: #ffe27a; color: #1a1a1a; border-radius: 2px; padding: 0 1px; }
.lt-row--match { background: rgba(255, 226, 122, 0.10); }
.lt-row--match-active { background: rgba(255, 150, 50, 0.18); border-left-color: #ff9632; }
.lt-row--match-active .lt-hl { background: #ff9632; color: #1a1a1a; }
.lt-side__raw .lt-hl { background: #ffe27a; color: #1a1a1a; }
.lt-head, .lt-row {
  display: grid;
  grid-template-columns: var(--lt-cols);
  align-items: center;
}
/* 列宽拖拽手柄：常驻可见的竖向握把，位于可调列头右缘 */
.lt-head > div { position: relative; }
.lt-resz {
  position: absolute; top: 0; right: 0; width: 10px; height: 100%;
  cursor: col-resize; z-index: 3;
  display: flex; align-items: center; justify-content: center;
}
.lt-resz::after {
  content: ''; width: 2px; height: 14px;
  background: var(--border-strong); border-radius: 1px;
  transition: height var(--transition), background var(--transition);
}
.lt-resz:hover::after { height: 70%; background: var(--text-heading); }
body.lt-resizing { cursor: col-resize !important; user-select: none; }
body.lt-resizing * { cursor: col-resize !important; }
.lt-head {
  height: 34px; background: var(--bg-surface-hover); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.3px;
}
.lt-head > div { padding: 0 10px; cursor: default; white-space: nowrap; overflow: hidden; }
.lt-head > [data-sort] { cursor: pointer; user-select: none; }
.lt-head > [data-sort]:hover { color: var(--text-heading); }

.lt-viewport { position: relative; height: 540px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.lt-viewport::-webkit-scrollbar { width: 9px; }
.lt-viewport::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.lt-spacer { width: 1px; }
.lt-rows { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }

.lt-row { height: 30px; border-bottom: 1px solid var(--border); border-left: 2px solid transparent; font-size: 12px; cursor: pointer; }
.lt-row:hover { background: var(--bg-surface-hover); }
.lt-row--risk { border-left-color: var(--severity-critical); background: var(--severity-critical-bg); }
.lt-row--risk:hover { background: #fbe9e9; }
.lt-c { padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lt-c--n { color: var(--text-ghost); font-family: var(--font-mono); }
.lt-c--ts, .lt-c--ip, .lt-c--by { font-family: var(--font-mono); color: var(--text-secondary); }
.lt-c--m { font-family: var(--font-mono); font-weight: 600; color: var(--text-heading); }
.lt-c--path { font-family: var(--font-mono); color: var(--text-heading); }
.lt-status { font-family: var(--font-mono); font-weight: 700; }
.lt-status--2xx { color: var(--severity-low); } .lt-status--3xx { color: var(--severity-info); }
.lt-status--4xx { color: var(--severity-medium); } .lt-status--5xx { color: var(--severity-critical); }
.lt-c--risk { display: flex; gap: 4px; flex-wrap: nowrap; }
.lt-tag { font-size: 10px; font-family: var(--font-mono); color: var(--severity-critical); background: var(--severity-critical-bg); padding: 1px 5px; border-radius: 3px; white-space: nowrap; }

/* ── 选中行高亮（与右侧详情侧栏联动） ── */
.lt-row--sel { background: rgba(58, 110, 165, 0.12); border-left-color: var(--severity-info); }
.lt-row--sel:hover { background: rgba(58, 110, 165, 0.17); }

/* ── 右侧详情侧栏：点击行后丝滑展开，左缘手柄可拖拽调宽 ── */
.lt-side {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: var(--lt-side);
  background: var(--bg-surface);
  z-index: 12; overflow: hidden;
  transition: width 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.lt.is-side-open .lt-side {
  border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.10);
}
/* 内容层锚定右缘且宽度恒定：展开动画为纯裁切滑出，文字不回流 */
.lt-side__inner {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: var(--lt-side-w, 420px);
  display: flex; flex-direction: column;
}
.lt-side__grip {
  position: absolute; top: 0; left: 0; width: 9px; height: 100%;
  cursor: col-resize; z-index: 3; display: none;
}
.lt.is-side-open .lt-side__grip { display: block; }
.lt-side__grip::after {
  content: ''; position: absolute; top: 50%; left: 3px; transform: translateY(-50%);
  width: 2px; height: 38px; background: var(--border-strong); border-radius: 1px;
  transition: height var(--transition), background var(--transition);
}
.lt-side__grip:hover::after { height: 72px; background: var(--text-heading); }
.lt-side__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 34px; padding: 0 8px 0 16px; flex: none;
  background: var(--bg-surface-hover); border-bottom: 1px solid var(--border);
}
.lt-side__title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.3px; white-space: nowrap;
}
.lt-side__close {
  border: 1px solid transparent; background: none; color: var(--text-secondary);
  cursor: pointer; border-radius: 4px; padding: 3px 8px; font-size: 13px; line-height: 1;
}
.lt-side__close:hover { background: var(--bg-surface); color: var(--text-heading); }
.lt-side__body { flex: 1; overflow-y: auto; padding: 12px 16px; scrollbar-width: thin; }
.lt-side__body::-webkit-scrollbar { width: 9px; }
.lt-side__body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.lt-side__meta {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted);
  margin: 0 0 10px; line-height: 1.7; word-break: break-all;
  padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
.lt-side__raw {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-heading);
  white-space: pre-wrap; word-break: break-all; margin: 0; line-height: 1.7;
}

.log-flash {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: var(--text-heading); color: var(--bg-surface); padding: 8px 16px; border-radius: var(--radius);
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60;
}
.log-flash.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 920px) {
  .log-dash { grid-template-columns: 1fr; }
  .log-tops { grid-template-columns: 1fr; }
  .lt-head, .lt-row { grid-template-columns: 44px 124px 110px 50px 52px 64px minmax(120px, 1fr) 96px; }
  .lt-c, .lt-head > div { padding: 0 6px; }
}
