/* app.css —— 净流观测台
 *
 * 无框架、无构建、无 CDN。CSP 保持 default-src 'self'：
 * 这份样式表提供全站共享样式（首页另有 overview.css 局部布局），脚本只通过 class 与 CSSOM 属性改样式，
 * 绝不 setAttribute('style')——那会被 CSP 拦下。
 *
 * 主题：data-theme="light|dark" 挂在 <html> 上，偏好存 localStorage。
 * 侧栏：data-sidebar="collapsed" 挂在 <html> 上，同样持久化。
 *
 * 视觉语言：蓝白黑配色、细边框、小圆角与线性图标；正文和数据分层；
 * 共用壳、筛选、表格和反馈，业务页按任务组织内容。
 */

/* ---------- 颜色与尺度 ---------- */

:root {
  color-scheme: light;
  --logo-light-display: block;
  --logo-dark-display: none;

  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-sunken: #f0f2f4;
  --bg-hover: #f3f4f6;
  --sidebar-bg: #fafafa;
  --border: #e4e6e9;
  --border-strong: #c9ced3;
  --hover-bg: var(--bg-hover);
  --hover-border: var(--border-strong);
  --hover-fg: var(--fg);
  --hover-duration: 120ms;

  --fg: #202329;
  --fg-muted: #485360;
  --fg-faint: #596572;

  --brand-blue: #2563eb;
  --brand-blue-strong: #1d4ed8;
  --brand-blue-soft: #eef4ff;
  --lamp-light: #dbe7ff;
  --accent: var(--brand-blue);
  --accent-strong: var(--brand-blue-strong);
  --accent-soft: var(--brand-blue-soft);
  --accent-soft-2: #e0eaff;
  --accent-fg: #ffffff;

  --ok: var(--brand-blue);
  --ok-bg: var(--brand-blue-soft);
  --warn: #465b80;
  --warn-bg: #f0f3f8;
  --bad: var(--fg);
  --bad-bg: #e9edf5;
  --muted-bg: #eff0f2;

  /* 图表系列色。深浅主题下都要能在白/黑底上读得清。 */
  --c-attack: #343941;
  --c-in: var(--brand-blue);
  --c-out: #8c929b;
  --c-cleaned: var(--brand-blue-strong);
  --c-policy: #416cb5;
  --c-single: #5e7294;
  --policy-color-1: #1d4ed8;
  --policy-color-2: #4f78d1;
  --policy-color-3: #8799b9;
  --policy-color-4: #202329;
  --policy-color-5: #41609b;
  --policy-color-6: #6f85b3;
  --policy-color-7: #a0b2d3;
  --policy-color-8: #586273;
  --network-heat-1: #eef4ff;
  --network-heat-2: #dbe8ff;
  --network-heat-3: #b6ceff;
  --network-heat-4: #83a9fa;
  --network-heat-5: #608be5;
  --network-heat-6: #285fca;
  --network-heat-7: #1744a2;
  --network-heat-ink-mid: var(--fg);

  --tip-bg: #292b2f;
  --tip-fg: #ffffff;

  --radius-lg: 3px;
  --radius: 2px;
  --radius-sm: 2px;
  --radius-xs: 2px;
  --shadow: none;
  --shadow-pop: 0 6px 24px rgb(24 24 24 / 10%);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --digits: "CubeDC", var(--sans);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --page-gutter: 28px;
  --control-height: 36px;
  --control-height-sm: 32px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;

  --sidebar-w: 216px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 60px;
}

/* 控件共用轻量颜色反馈；不为普通悬停增加位移、缩放或阴影。 */
:where(.nav-item, .theme-btn, .icon-btn, .btn, .xs-trigger, .xs-option,
  .pagination-button, .link-btn, .dp-trigger, .dp-shortcut, .dp-nav-button, .dp-day,
  .target-combobox-toggle, .target-option, .account-tab, .workspace-tabs > button,
  .manage-tabs .btn, .analysis-custom-query > summary, .filter-advanced > summary,
  .manage-task-fold > summary, .attacked-low > summary, .overview-disclosure > summary,
  .page-help > summary, .overview-help > summary, details.context-help > summary,
  .overview-details-toggle, .overview-icon-link, .event-detail, .operations-blackhole,
  .heat-cell, .network-rank, .feedback-close, .sidebar-profile, .sidebar-logout, .card-link) {
  transition: background-color var(--hover-duration) ease, border-color var(--hover-duration) ease,
    color var(--hover-duration) ease, box-shadow var(--hover-duration) ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --logo-light-display: none;
    --logo-dark-display: block;
    --bg: #191a1d;
    --bg-elev: #202125;
    --bg-sunken: #28292e;
    --bg-hover: #1d1e22;
    --hover-bg: #2c2e34;
    --sidebar-bg: #1d1e22;
    --border: #33353a;
    --border-strong: #50535a;

    --fg: #e9e9eb;
    --fg-muted: #c9ced6;
    --fg-faint: #afb8c4;

    --brand-blue: #8badff;
    --brand-blue-strong: #acc5ff;
    --brand-blue-soft: #242e46;
    --lamp-light: #e6edff;
    --accent-soft-2: #303d5b;
    --accent-fg: #111827;

    --warn: #b4c2df;
    --warn-bg: #292f3b;
    --bad-bg: #303744;
    --muted-bg: #2a2c31;

    --c-attack: #d7dde7;
    --c-out: #9297a0;
    --c-policy: #9ab5eb;
    --c-single: #a4b2ce;
    --policy-color-1: #8badff;
    --policy-color-2: #bdd0ff;
    --policy-color-3: #7c95c7;
    --policy-color-4: #e9e9eb;
    --policy-color-5: #658deb;
    --policy-color-6: #a0abd0;
    --policy-color-7: #596e98;
    --policy-color-8: #a7b2c7;
    --network-heat-1: #26334f;
    --network-heat-2: #304668;
    --network-heat-3: #3a5b8a;
    --network-heat-4: #7299d9;
    --network-heat-5: #8badff;
    --network-heat-6: #acc5ff;
    --network-heat-7: #dbe7ff;
    --network-heat-ink-mid: #111827;

    --tip-bg: #f1f2f4;
    --tip-fg: #191a1d;
    --shadow: none;
    --shadow-pop: 0 10px 32px -8px rgba(0, 0, 0, .7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --logo-light-display: none;
  --logo-dark-display: block;
  --bg: #191a1d;
  --bg-elev: #202125;
  --bg-sunken: #28292e;
  --bg-hover: #1d1e22;
  --hover-bg: #2c2e34;
  --sidebar-bg: #1d1e22;
  --border: #33353a;
  --border-strong: #50535a;
  --fg: #e9e9eb;
  --fg-muted: #c9ced6;
  --fg-faint: #afb8c4;
  --brand-blue: #8badff;
  --brand-blue-strong: #acc5ff;
  --brand-blue-soft: #242e46;
  --lamp-light: #e6edff;
  --accent-soft-2: #303d5b;
  --accent-fg: #111827;
  --warn: #b4c2df;
  --warn-bg: #292f3b;
  --bad-bg: #303744;
  --muted-bg: #2a2c31;
  --c-attack: #d7dde7;
  --c-out: #9297a0;
  --c-policy: #9ab5eb;
  --c-single: #a4b2ce;
  --policy-color-1: #8badff;
  --policy-color-2: #bdd0ff;
  --policy-color-3: #7c95c7;
  --policy-color-4: #e9e9eb;
  --policy-color-5: #658deb;
  --policy-color-6: #a0abd0;
  --policy-color-7: #596e98;
  --policy-color-8: #a7b2c7;
  --network-heat-1: #26334f;
  --network-heat-2: #304668;
  --network-heat-3: #3a5b8a;
  --network-heat-4: #7299d9;
  --network-heat-5: #8badff;
  --network-heat-6: #acc5ff;
  --network-heat-7: #dbe7ff;
  --network-heat-ink-mid: #111827;
  --tip-bg: #f1f2f4;
  --tip-fg: #191a1d;
  --shadow: none;
  --shadow-pop: 0 10px 32px -8px rgba(0, 0, 0, .7);
}

/* ---------- 基础 ---------- */

* { box-sizing: border-box; }

/* hidden 属性一律生效：.btn 等组件自带 display，会盖过浏览器默认的 [hidden]。
   页面常驻的控件靠切换 hidden 显示或隐藏，而不是整块重建。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--font-reading);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.005em; }

.sprite { display: none; }

svg.nav-icon, .icon-btn svg, .theme-btn svg, .chip-icon, .planned-icon svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  left: 12px; top: 12px; z-index: 100;
  background: var(--bg-elev); padding: 8px 12px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 壳：侧栏 ---------- */

.shell { display: flex; min-height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 17px 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .18s ease, flex-basis .18s ease;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 5px 18px; color: inherit; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { display: block; min-width: 0; }
/* 透明底融入页面；深色主题只换浅色字标，云图标保留品牌原色。 */
.brand-logo { padding: 4px 6px; object-fit: contain; }
.brand-mark .brand-logo { width: 150px; max-width: 100%; height: auto; display: var(--logo-light-display); }
.brand-mark .brand-logo--dark { display: var(--logo-dark-display); }
.brand-mark .brand-icon { display: none; width: 34px; height: 34px; border-radius: 2px; }
html[data-sidebar="collapsed"] .brand-mark .brand-logo { display: none; }
html[data-sidebar="collapsed"] .brand-mark .brand-icon { display: block; }

.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.nav-group-label {
  color: color-mix(in srgb, var(--fg-faint) 90%, var(--sidebar-bg));
  font-size: var(--font-caption); font-weight: 400; line-height: 1.35; letter-spacing: .08em;
  padding: 0 10px 6px; white-space: nowrap;
}
:where(.nav-group + .nav-group) > .nav-group-label { padding-top: 20px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--fg-muted); text-decoration: none; font-size: var(--font-body); font-weight: 500;
  white-space: nowrap; position: relative;
}
@media (hover: hover) {
  .nav-item:where(:not(.is-active, [aria-disabled="true"])):hover { background: var(--hover-bg); color: var(--hover-fg); text-decoration: none; }
}
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 550; }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon { color: var(--fg-muted); width: 16px; height: 16px; stroke-width: 1.45; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item.is-planned { color: var(--fg-faint); }
.nav-item.is-planned .nav-icon { opacity: .75; }
.nav-tag {
  font-size: var(--font-caption); line-height: 1; padding: 3px 6px; border-radius: 99px;
  background: var(--muted-bg); color: var(--fg-faint); letter-spacing: .04em; font-weight: 600;
}
.nav-item.is-active .nav-tag { background: var(--accent-soft-2); color: var(--accent); }

.sidebar-foot { flex-shrink: 0; margin-top: auto; padding-top: 12px; }
.sidebar-appearance { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.theme-switch {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; width: 100%;
  padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-sunken);
}
.theme-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0;
  height: 30px; border: none; border-radius: var(--radius); background: transparent;
  color: var(--fg-faint); cursor: pointer; font: inherit; font-size: var(--font-body);
}
@media (hover: hover) {
  .theme-btn:where(:not(:disabled, [aria-pressed="true"])):hover { background: var(--hover-bg); color: var(--hover-fg); }
}
.theme-btn[aria-pressed="true"] { background: var(--bg-elev); color: var(--accent); box-shadow: none; }
.theme-btn svg { width: 14px; height: 14px; }
/* 顶部吊灯反馈：拉绳触发，灯泡为整页明暗扩散原点，不改变页面排版。 */
.theme-feedback { position: fixed; inset: 0; z-index: 2000; pointer-events: none; opacity: 0; }
.theme-feedback[hidden] { display: none; }
.theme-feedback-lamp { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--fg); }
.theme-lamp { display: block; width: 144px; height: auto; overflow: visible; }
.theme-lamp-shade { fill: var(--bg-elev); }
.theme-lamp-beam { fill: var(--lamp-light); fill-opacity: 0; stroke: none; }
.theme-lamp-bulb { fill: var(--lamp-light); fill-opacity: 0; }
.theme-lamp-rays, .theme-lamp-filament { opacity: .25; }
.theme-lamp-beam, .theme-lamp-bulb, .theme-lamp-rays, .theme-lamp-filament { transition: fill-opacity 160ms ease, opacity 160ms ease; }
.theme-feedback[data-lit="true"] .theme-lamp-beam { fill-opacity: .28; }
.theme-feedback[data-lit="true"] .theme-lamp-bulb { fill-opacity: .8; }
.theme-feedback[data-lit="true"] .theme-lamp-rays, .theme-feedback[data-lit="true"] .theme-lamp-filament { opacity: 1; }
.theme-feedback-label { font-size: var(--font-label); line-height: 1.5; letter-spacing: .04em; color: var(--fg-muted); }
.theme-light-wave { position: fixed; left: var(--theme-origin-x, 50%); top: var(--theme-origin-y, 96px); width: 80px; height: 80px; border-radius: 50%; background: #dbe7ff; opacity: 0; transform: translate(-50%, -50%) scale(0); }
.theme-feedback[data-destination="dark"] .theme-light-wave { background: #111827; }
:root[data-theme-spreading] .theme-feedback-lamp { view-transition-name: theme-lamp; }
:root[data-theme-spreading]::view-transition { pointer-events: none; }
:root[data-theme-spreading]::view-transition-group(root) { z-index: 0; animation: none; }
:root[data-theme-spreading]::view-transition-old(root),
:root[data-theme-spreading]::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-theme-spreading]::view-transition-old(root) { z-index: 0; }
:root[data-theme-spreading]::view-transition-new(root) { z-index: 1; animation: theme-light-spread 1000ms cubic-bezier(.22,.68,.2,1) both; }
:root[data-theme-spreading]::view-transition-group(theme-lamp) { z-index: 1; animation: none; }
:root[data-theme-spreading]::view-transition-old(theme-lamp) { display: none; }
:root[data-theme-spreading]::view-transition-new(theme-lamp) { animation: none; mix-blend-mode: normal; }
@keyframes theme-light-spread {
  from { clip-path: circle(0px at var(--theme-origin-x) var(--theme-origin-y)); }
  to { clip-path: circle(var(--theme-spread-radius) at var(--theme-origin-x) var(--theme-origin-y)); }
}
/* 临时启用颜色过渡，不动画尺寸、排版或数据位置。首次加载立即恢复偏好。 */
:where(:root[data-theme-animating] body, :root[data-theme-animating] body *) {
  transition-property: background-color, color, border-color, fill, stroke, box-shadow;
  transition-duration: 360ms;
  transition-timing-function: cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-reduced-motion: reduce) {
  .theme-feedback { display: none !important; }
  :root[data-theme-animating] body,
  :root[data-theme-animating] body * { transition: none !important; }
}
@media print { .theme-feedback { display: none !important; } }

/* 折叠态：只留图标 */
html[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); padding-left: 10px; padding-right: 10px; }
html[data-sidebar="collapsed"] .brand { justify-content: center; padding-left: 0; padding-right: 0; }
html[data-sidebar="collapsed"] .nav-label,
html[data-sidebar="collapsed"] .nav-tag,
html[data-sidebar="collapsed"] .theme-btn-label,
html[data-sidebar="collapsed"] .sidebar-user-copy { display: none; }
html[data-sidebar="collapsed"] .nav-group-label { text-align: center; padding-left: 0; padding-right: 0; font-size: 0; height: 1px; background: var(--border); margin: 8px 8px 6px; padding: 0; }
html[data-sidebar="collapsed"] .nav-group:first-child .nav-group-label { display: none; }
html[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 0; }
html[data-sidebar="collapsed"] .sidebar-user { flex-direction: column; gap: 6px; }
html[data-sidebar="collapsed"] .sidebar-profile { flex: none; padding: 3px; }
html[data-sidebar="collapsed"] .sidebar-appearance { padding-inline: 0; }
html[data-sidebar="collapsed"] .theme-switch { grid-template-columns: 1fr; width: 100%; }
html[data-sidebar="collapsed"] .icon-btn#sidebar-toggle { color: var(--accent); }

/* ---------- 壳：内容区 ---------- */

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: var(--topbar-h); padding: 12px var(--page-gutter);
  border-bottom: 1px solid var(--border); background: var(--bg-elev);
  position: relative; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 660; line-height: 1.25; }
.subtitle {
  margin: 2px 0 0; color: var(--fg-muted); font-size: var(--font-body);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72ch;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--fg-muted);
  cursor: pointer; font: inherit; flex: none;
}
@media (hover: hover) {
  .icon-btn:where(:not(:disabled, [aria-disabled="true"], .is-busy)):hover { background: var(--hover-bg); color: var(--hover-fg); }
}

.topbar-status { display: flex; align-items: center; gap: 12px; flex: none; }
.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: auto; padding: 0; border-radius: 0;
  border: 0; background: transparent;
  font-size: var(--font-label); color: var(--fg-muted); white-space: nowrap;
}
.status-chip--quiet { display: none; }
.status-chip--quiet .chip-icon { width: 14px; height: 14px; color: var(--fg-faint); }
.chip-sep { width: 1px; height: 14px; background: var(--border-strong); opacity: .7; }
.conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint); flex: none; box-shadow: 0 0 0 3px transparent; }
.conn-dot[data-phase="connected"] { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.conn-dot[data-phase="connecting"] { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.conn-dot[data-phase="error"] { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
[data-conn-chip][data-phase="connected"] [data-conn-text] { color: var(--fg); font-weight: 560; }
[data-conn-chip][data-phase="error"] { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
[data-data-age][data-tone="warn"] { color: var(--warn); font-weight: 560; }
[data-data-age][data-tone="bad"] { color: var(--bad); font-weight: 620; }

.main {
  flex: 1; padding: 16px var(--page-gutter) 30px;
  display: flex; flex-direction: column; gap: var(--space-4);
  width: 100%; min-width: 0;
}
.main > div:empty { display: none; }
.page-loading { color: var(--fg-muted); padding: 32px 0; }

.footer { padding: 14px 28px 22px; border-top: 1px solid var(--border); }
.metric-note { margin: 0; font-size: var(--font-body); color: var(--fg-faint); max-width: 110ch; line-height: 1.6; }
.metric-note strong { color: var(--fg-muted); font-weight: 600; }
.metric-note-label {
  display: inline-block; font-size: var(--font-caption); letter-spacing: .06em; font-weight: 640;
  padding: 1px 6px; border-radius: 4px; margin-right: 6px;
  background: var(--muted-bg); color: var(--fg-muted); vertical-align: 1px;
}

.banner-slot:empty { display: none; }
.banner {
  --notice-color: var(--accent);
  --notice-icon: url('/static/icons/feedback-info.svg');
  position: relative; min-width: 0; margin: 0; padding: 10px 12px 10px 40px;
  display: flex; align-items: center; gap: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--notice-color) 14%, var(--bg-elev)); border-radius: 4px;
  background: color-mix(in srgb, var(--notice-color) 4%, var(--bg-elev)); color: var(--fg);
  font-size: var(--font-body); line-height: 20px; font-weight: 400; overflow-wrap: anywhere;
}
.banner::before, .errorbox::before, .login-error::before {
  content: ''; position: absolute; left: 12px; top: 50%; width: 16px; height: 16px;
  transform: translateY(-50%);
  background: var(--notice-color); mask: var(--notice-icon) center / contain no-repeat;
}
.banner--bad { --notice-color: var(--bad); --notice-icon: url('/static/icons/feedback-error.svg'); }
.banner--warn { --notice-color: var(--warn); --notice-icon: url('/static/icons/feedback-warning.svg'); }
.banner--success { --notice-color: var(--ok); --notice-icon: url('/static/icons/feedback-success.svg'); }
.banner-slot > .banner { padding-left: calc(var(--page-gutter) + 28px); padding-right: var(--page-gutter); border-radius: 0; border-inline: 0; border-top: 0; background: color-mix(in srgb, var(--notice-color) 7%, var(--bg-elev)); }
.banner-slot > .banner::before { left: var(--page-gutter); }

/* ---------- 区块标题：圆点 + 标签 + 细线 ---------- */

.section-head {
  display: flex; align-items: center; gap: 10px; min-height: 22px; margin-top: 4px;
}
.section-head:first-child { margin-top: 0; }
.section-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.section-head--ok .section-dot { background: var(--ok); }
.section-head--warn .section-dot { background: var(--warn); }
.section-head--bad .section-dot { background: var(--bad); }
.section-head--muted .section-dot { background: var(--fg-faint); }
.section-label { font-size: var(--font-body); font-weight: 620; color: var(--fg-muted); letter-spacing: .02em; white-space: nowrap; }
.section-rule { flex: 1; height: 1px; background: var(--border); }
.section-side { display: flex; align-items: center; gap: 8px; font-size: var(--font-body); color: var(--fg-faint); white-space: nowrap; }

/* ---------- KPI 卡片 ---------- */

.cards {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 0;
}
.card-label {
  font-size: var(--font-body); color: var(--fg-muted); letter-spacing: .01em;
  display: flex; align-items: center; gap: 6px; min-height: 18px;
}
.hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong);
  color: var(--fg-faint); font-size: var(--font-caption); font-weight: 700; line-height: 1; cursor: help;
  font-family: Georgia, serif; font-style: italic; flex: none;
}
@media (hover: hover) {
  .hint:hover { border-color: var(--accent); color: var(--accent); }
}
.card-value { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; min-width: 0; }
.card-number {
  font-family: var(--digits); font-size: 30px; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-unit { font-size: var(--font-body); color: var(--fg-muted); font-weight: 500; }
.card--attack .card-number { color: var(--c-attack); }
.card--accent .card-number { color: var(--accent); }
.card--ok .card-number { color: var(--ok); }
.card--warn .card-number { color: var(--warn); }
.card--bad .card-number { color: var(--bad); }
.card--empty .card-number { color: var(--fg-faint); font-weight: 500; }
.card-foot { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-height: 18px; }
.card-empty-note {
  font-size: var(--font-label); font-weight: 600; padding: 2px 7px; border-radius: 99px;
  background: var(--muted-bg); color: var(--fg-muted); letter-spacing: .02em;
}
.card-footnote { font-size: var(--font-body); color: var(--fg-faint); line-height: 1.45; }

/* ---------- 面板 ---------- */

.panel {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  min-width: 0;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px 20px 0;
}
.panel-head > div:first-child { min-width: 0; }
.panel-head--divided { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.panel-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.005em; }
.panel-sub { margin: 3px 0 0; font-size: var(--font-body); color: var(--fg-muted); }
.panel-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.panel-body { padding: 14px 20px 18px; }
.panel-body--flush { padding: 0; }
.panel-body--flush > .metric-footnote { padding: 12px 20px 0; }
.panel-body--flush > .emptybox { border-top: 1px solid var(--border); }
.panel-link { font-size: var(--font-body); font-weight: 560; white-space: nowrap; }
.panel-actions input[type="search"], .panel-search { width: 220px; height: 32px; }

/* 面板内的大数字（面板标题下方，跟趋势图配套） */
.panel-kpi { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 14px 0 6px; }
.panel-kpi-value { font-family: var(--digits); font-size: 28px; font-weight: 660; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.panel-kpi-value.is-empty { color: var(--fg-faint); font-weight: 500; }
.panel-kpi-label { font-size: var(--font-body); color: var(--fg-muted); }
.panel-kpi--attack .panel-kpi-value { color: var(--c-attack); }

.panel-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 6px; }
.panel-subhead h3 { margin: 0; font-size: var(--font-body); font-weight: 620; }
.panel-subhead p { margin: 0; font-size: var(--font-body); color: var(--fg-muted); }

.chart-host { width: 100%; height: 250px; position: relative; }
.chart-host--short { height: 170px; }
.chart-host--tall { height: 300px; }
.strip-host { width: 100%; }

/* ---------- 图表 ---------- */

.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-axis { fill: var(--fg-faint); font-size: var(--font-caption); font-family: var(--mono); }
.chart-baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart-empty { fill: var(--fg-faint); font-size: var(--font-body); font-family: var(--sans); }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { opacity: .95; }
.chart-halo { opacity: .18; }
.chart-area { stroke: none; }
.grad-top { stop-color: var(--series); stop-opacity: .26; }
.grad-bottom { stop-color: var(--series); stop-opacity: 0; }
.chart-focus { pointer-events: none; }
.chart-focus-line { stroke: var(--border-strong); stroke-width: 1; }
.chart-focus-dot { stroke: var(--bg-elev); stroke-width: 2; }
.chart-hit { fill: transparent; cursor: crosshair; }

.bar-hatch-line { stroke: var(--accent); stroke-width: 1.2; opacity: .55; }
.bar-hatch-bg { fill: var(--accent); opacity: .07; }
.bar-grad-top { stop-color: var(--accent); stop-opacity: 1; }
.bar-grad-bottom { stop-color: var(--accent); stop-opacity: .55; }
.bar { transition: opacity .12s ease; }
.bar--muted { opacity: .55; }
.bar-slot { fill: transparent; }

.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--tip-bg); color: var(--tip-fg);
  border-radius: var(--radius); padding: 7px 10px 8px; font-size: var(--font-body); line-height: 1.4;
  box-shadow: var(--shadow-pop); min-width: 120px; max-width: 260px;
  transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap;
  opacity: 0; transition: opacity .1s ease;
}
.chart-tip.is-visible { opacity: 1; }
/* 悬停点靠近上缘时翻到点的下方，避免顶出图表盖住面板标题 */
.chart-tip.is-below { transform: translate(-50%, 12px); }
.chart-tip.is-below::after { bottom: auto; top: -5px; }
.chart-tip::after {
  content: ''; position: absolute; left: var(--chart-tip-arrow-x, 50%); bottom: -5px; width: 10px; height: 10px;
  background: var(--tip-bg); transform: translateX(-50%) rotate(45deg); border-radius: 2px;
}
.chart-tip-title { font-weight: 640; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.chart-tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; opacity: .92; }
.chart-tip-row i { width: 8px; height: 8px; border-radius: 2px; background: var(--swatch); display: inline-block; margin-right: 6px; flex: none; }
.chart-tip-row span:first-child { display: inline-flex; align-items: center; }
.chart-tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: var(--font-label); }
.chart-tip-row.is-null b { opacity: .6; font-family: var(--sans); }
.chart-tip-note { max-width: 220px; white-space: normal; margin-top: 7px; padding-top: 6px; border-top: 1px solid currentColor; opacity: .8; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: var(--font-body); color: var(--fg-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--swatch); }
.legend-swatch.is-dashed { background: repeating-linear-gradient(90deg, var(--swatch) 0 4px, transparent 4px 7px); }
.legend-note { color: var(--fg-faint); font-style: italic; }

.cell { stroke: none; }
.cell--ok { fill: var(--ok); opacity: .5; }
.cell--alert { fill: var(--c-attack); }
.cell--idle { fill: var(--border-strong); opacity: .6; }
.cell--gap { fill: var(--bad); }
.cell--outage { fill: var(--warn); }
.cell--down { fill: var(--fg-faint); }
.cell--pending { fill: var(--accent); opacity: .35; }
.cell--immature { fill: var(--accent); opacity: .16; }
.cell--unknown { fill: var(--muted-bg); }
.cell--unreported { fill: var(--border-strong); stroke: var(--fg-faint); stroke-width: .5; }
.cell--partial { fill: var(--warn); opacity: .5; }

.strip-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: var(--font-label); color: var(--fg-muted); }
.strip-legend span { display: inline-flex; align-items: center; gap: 5px; }
.strip-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.sparkline { vertical-align: middle; color: var(--c-attack); }

/* ---------- 占比条（列表行式） ---------- */

.sharebars { display: flex; flex-direction: column; }
.sharebar {
  display: grid; grid-template-columns: minmax(140px, 240px) 1fr auto; gap: 14px; align-items: center;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.sharebar:last-child { border-bottom: none; }
.sharebar-label { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sharebar-name { font-size: var(--font-body); font-weight: 560; display: flex; align-items: center; gap: 6px; min-width: 0; }
.sharebar-name > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sharebar-sub { font-size: var(--font-label); color: var(--fg-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sharebar-flag {
  font-size: var(--font-caption); padding: 1px 6px; border-radius: 99px; font-weight: 600;
  background: var(--warn-bg); color: var(--warn); white-space: nowrap; cursor: help; flex: none;
}
.sharebar-track { height: 8px; background: var(--bg-sunken); border-radius: 4px; overflow: hidden; }
.sharebar-fill { height: 100%; background: var(--c-attack); border-radius: 4px; min-width: 2px; opacity: .9; }
.sharebar-value { font-family: var(--mono); font-size: var(--font-body); color: var(--fg-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 表格 ---------- */

.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--font-body); }
.table th, .table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap; vertical-align: middle; line-height: 20px;
}
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table th {
  font-weight: 500; color: var(--fg-muted); font-size: var(--font-body); letter-spacing: .01em;
  background: var(--bg-hover); position: sticky; top: 0; z-index: 1;
  border-top: 1px solid var(--border);
}
.table tbody tr:last-child td { border-bottom: none; }
@media (hover: hover) {
  .table tbody tr:where(:not([aria-disabled="true"], .object-removing)):hover td { background: var(--hover-bg); }
}
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tr.is-clickable:focus-visible td { background: var(--accent-soft); }
.drawer:focus { outline: none; }
.table .align-right { text-align: right; font-variant-numeric: tabular-nums; }
.table .align-right .mono, .table td.align-right { font-family: var(--digits); font-size: var(--font-body); }
.table th.align-right { font-family: var(--sans); font-size: var(--font-body); }
.table .align-center { text-align: center; }
.table .wrap { white-space: normal; }
.table td.align-right .cell-main { justify-content: flex-end; }
.table td.align-center .cell-main { justify-content: center; }
.table td.align-right .cell-sub { text-align: right; }
.table-cell--actions { width: 1%; }
.table-actions, .table-cell-group { display: inline-flex; align-items: center; gap: 6px; vertical-align: middle; }
.table-actions { flex-wrap: wrap; }
.table td .table-actions { flex-wrap: nowrap; }
.table-cell-group { flex-wrap: wrap; }
.table td :is(.btn, .btn--sm) { height: 28px; padding-inline: 8px; font-family: var(--sans); font-size: var(--font-body); }
.table td :is(.table-actions, .btn-group) { gap: 6px; }

.cell-two { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.35; }
.cell-main { font-weight: 560; display: flex; align-items: center; gap: 8px; }
.cell-sub { font-size: var(--font-label); color: var(--fg-faint); }
/* 表体以常规字重阅读，主次由字号与灰度区分，避免每列都像强调项。 */
.table tbody :is(.cell-main, .badge, .btn, .event-cell a, .attacked-ip) { font-weight: 400; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fg-faint); display: inline-block; flex: none; }
.status-dot--ok { background: var(--ok); }
.status-dot--warn { background: var(--warn); }
.status-dot--bad { background: var(--bad); }
.status-dot--warn { border-radius: 1px; transform: rotate(45deg); }
.status-dot--bad, .conn-dot[data-phase="error"] { border-radius: 1px; }
.status-dot--accent { background: var(--accent); }

.link-btn {
  padding: 0; border: none; background: none; cursor: pointer; font: inherit;
  color: var(--accent); font-family: var(--mono); font-size: var(--font-body);
}
@media (hover: hover) {
  .link-btn:where(:not(:disabled, [aria-disabled="true"], .is-busy)):hover { text-decoration: underline; text-underline-offset: 2px; }
}

/* ---------- 徽章 ---------- */

/* 与 .tag、按钮同为 2px 小圆角：胶囊形一折行就成了圆团。
   标记点对齐第一行文字；正文由 badgeText() 按「 · 」分段，只在段间折行。 */
.badge {
  display: inline-flex; align-items: flex-start; gap: 6px; max-width: 100%;
  padding: 3px 8px; border-radius: var(--radius); font-size: var(--font-label); font-weight: 600;
  white-space: nowrap; line-height: 1.3;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; opacity: .9;
  margin-top: .4em; margin-top: calc(.5lh - 3px);
}
/* 段是行内块：放得下就整段换到下一行，只有一段本身比徽标还宽时才在段内折行。 */
.badge-text { min-width: 0; }
.badge-seg { display: inline-block; max-width: 100%; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad { background: var(--bad-bg); color: var(--bad); }
.badge--muted { background: var(--muted-bg); color: var(--fg-muted); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--plain::before { display: none; }
.badge--warn::before { border-radius: 1px; transform: rotate(45deg); }
.badge--bad::before { border-radius: 1px; }

/* Attacked overview: retain the shared panel and table styling. */
.attacked-toolbar { flex-wrap: wrap; }
.attacked-toolbar select { max-width: 230px; }
.attacked-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.attacked-actions [hidden] { display: none; }
.attacked-actions .faint { margin-left: auto; font-size: var(--font-body); }
.attacked-group--bad { border-left: 3px solid var(--bad); }
.attacked-types { display: flex; flex-wrap: wrap; gap: 5px; min-width: 140px; max-width: 250px; }
.attacked-manual { color: var(--warn); background: var(--warn-bg); }
.attacked-ip { color: var(--accent); text-decoration: none; font-weight: 600; }
.attacked-ip:hover { text-decoration: underline; }
.attacked-row-state { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.attacked-low summary { padding: 18px 20px; cursor: pointer; font-weight: 600; }
.attacked-spark { display: block; width: 108px; height: 32px; color: var(--c-attack); }
.attacked-spark polyline { fill: none; stroke: currentColor; stroke-width: 1.6; }
.attacked-spark circle { fill: currentColor; }
.attacked-return { align-self: flex-start; }
.attacked-content .pager .field { margin-left: auto; }
@media (max-width: 760px) {
  .attacked-toolbar .field { flex: 1 1 140px; }
  .attacked-toolbar select { max-width: 100%; }
  .attacked-actions .faint { margin-left: 0; width: 100%; }
}
.badge-sub { color: var(--fg-muted); font-weight: 400; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius);
  background: var(--muted-bg); color: var(--fg-muted);
  font-size: var(--font-label); font-family: var(--mono); line-height: 1.4; white-space: nowrap;
}
.tag--dst { background: var(--accent-soft); color: var(--accent); }
.tag--src { background: var(--accent-soft); color: var(--c-policy); }
.tag--policy { background: var(--warn-bg); color: var(--warn); }
.tag--alert { background: var(--bad-bg); color: var(--bad); }

/* ---------- 表单 ---------- */

.toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.toolbar-grow { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--font-body); color: var(--fg-muted); font-weight: 560; letter-spacing: .01em; }
input, select, button, textarea { font: inherit; }
input[type="text"], input[type="search"], input[type="number"], input[type="datetime-local"], select {
  height: var(--control-height); padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--fg); min-width: 0; width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder { color: var(--fg-faint); }
input[type="search"] { padding-left: 32px; background-repeat: no-repeat; background-position: 11px center; background-size: 14px; }
input[type="search"] {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c95a4' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M20 20l-3.5-3.5'/></svg>");
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.is-invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c95a4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-height); padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--fg); cursor: pointer; font-weight: 540; font-size: var(--font-body);
  transition: border-color var(--hover-duration) ease, background-color var(--hover-duration) ease, color var(--hover-duration) ease;
  white-space: nowrap; line-height: 20px; vertical-align: middle; text-decoration: none;
}
@media (hover: hover) {
  .btn:where(:not(:disabled, [aria-disabled="true"], .is-busy, [aria-pressed="true"], [aria-selected="true"])):hover { border-color: var(--hover-border); background: var(--hover-bg); text-decoration: none; }
}
.btn--primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); box-shadow: none; }
@media (hover: hover) {
  .btn--primary:where(:not(:disabled, [aria-disabled="true"], .is-busy, [aria-pressed="true"])):hover { background: var(--accent-strong); border-color: var(--accent-strong); }
}
.btn--sm { height: var(--control-height-sm); padding: 0 10px; font-size: var(--font-body); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--fg-muted); }
@media (hover: hover) {
  .btn--ghost:where(:not(:disabled, [aria-disabled="true"], .is-busy)):hover { background: var(--hover-bg); color: var(--hover-fg); }
}
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 6px; }

/* 分段控件：一组互斥选项，选中的填成主色（参考「近 7 天 / 近 30 天」） */
.segmented {
  --segment-height: var(--control-height);
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 2px;
  width: fit-content; max-width: 100%; min-height: var(--segment-height); height: auto; vertical-align: top;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-sunken);
}
.segmented > .btn {
  /* 外框上下各 1 px 边框 + 2 px 留白；内项不能继承筛选按钮的整框高度。 */
  height: calc(var(--segment-height) - 6px); min-height: calc(var(--segment-height) - 6px);
  flex: 0 0 auto; margin: 0; padding: 0 12px; border: 0;
  background: transparent; color: var(--fg-muted); box-shadow: none;
  border-radius: var(--radius); font-size: var(--font-body); line-height: 20px; font-weight: 500;
}
@media (hover: hover) {
  .segmented > .btn:where(:not(:disabled, [aria-disabled="true"], .is-busy, [aria-pressed="true"])):hover { color: var(--hover-fg); background: var(--hover-bg); }
}
.segmented > .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.segmented--sm { --segment-height: var(--control-height-sm); }
.segmented--sm > .btn { padding-inline: 10px; }

/* ---------- 状态盒 ---------- */

.errorbox {
  --notice-color: var(--bad);
  --notice-icon: url('/static/icons/feedback-error.svg');
  position: relative; min-width: 0; padding: 8px 12px 8px 40px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  background: color-mix(in srgb, var(--notice-color) 3%, var(--bg-elev)); color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--notice-color) 14%, var(--bg-elev)); border-radius: 4px;
  font-size: var(--font-body); line-height: 20px; overflow-wrap: anywhere;
  animation: notice-enter 150ms ease-out;
}
.errorbox--info { --notice-color: var(--accent); --notice-icon: url('/static/icons/feedback-info.svg'); }
.errorbox--warn { --notice-color: var(--warn); --notice-icon: url('/static/icons/feedback-warning.svg'); }
.errorbox--success { --notice-color: var(--ok); --notice-icon: url('/static/icons/feedback-success.svg'); }
.errorbox-content { flex: 1 1 240px; min-width: 0; }
.errorbox-msg { margin: 0; font-weight: 400; }
.errorbox-code { margin: 2px 0 0; color: var(--fg-muted); font-size: var(--font-label); line-height: 18px; font-family: var(--mono); overflow-wrap: anywhere; }
.errorbox > :is(.errorbox-msg, .notes) { flex-basis: 100%; }
.errorbox > .notes { margin: 0; }
.errorbox .errorbox-retry { flex: none; margin: 0 0 0 auto; padding: 0 8px; height: 28px; min-height: 28px; background: transparent; border-color: transparent; color: var(--accent); font-size: var(--font-body); font-weight: 400; }
@media (hover: hover) { .errorbox .errorbox-retry:hover { color: var(--accent-strong); background: var(--accent-soft); border-color: transparent; } }
@media (max-width: 500px) { .errorbox { gap: 6px 10px; } .errorbox-content { flex-basis: 160px; } }
@media (pointer: coarse) { .errorbox .errorbox-retry { min-width: 44px; min-height: 44px; } }
@keyframes notice-enter { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .errorbox { animation: none; } }

.emptybox { padding: 32px 20px; text-align: center; color: var(--fg-muted); }
.emptybox-title { margin: 0; font-size: 14px; font-weight: 560; }
.emptybox-detail { margin: 6px auto 0; font-size: var(--font-body); color: var(--fg-faint); max-width: 62ch; line-height: 1.55; }

.notes { margin: 10px 0 0; padding-left: 18px; font-size: var(--font-body); color: var(--fg-faint); }
.notes li { margin: 3px 0; }
.metric-footnote { margin: 10px 0 0; font-size: var(--font-body); color: var(--fg-faint); line-height: 1.55; }
.metric-footnote--tight { margin-top: 6px; }

/* 未接线的页面：讲清这一页将回答什么、依赖哪个阶段，而不是永久「正在加载」 */
.planned {
  background: var(--bg-elev); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg); padding: 44px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.planned-icon {
  width: 52px; height: 52px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
.planned-icon svg { width: 24px; height: 24px; }
.planned-title { margin: 0; font-size: 17px; font-weight: 650; }
.planned-desc { margin: 0; font-size: var(--font-body); color: var(--fg-muted); max-width: 64ch; line-height: 1.6; }
.planned-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
.planned-list {
  margin: 14px 0 0; padding: 0; list-style: none; text-align: left;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; width: 100%; max-width: 860px;
}
.planned-list li {
  background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: var(--font-body); color: var(--fg-muted); line-height: 1.5; display: flex; gap: 10px; align-items: flex-start;
}
.planned-list li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 7px; }

/* ---------- 骨架屏 ---------- */

.skeleton-page { display: flex; flex-direction: column; gap: 16px; }
.skeleton {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--bg-sunken); border: 1px solid var(--border);
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); }
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--line { height: 20px; width: 220px; border-radius: var(--radius); border: none; }
.skeleton-cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.skeleton--card { height: 112px; }
.skeleton--panel { height: 320px; }

/* ---------- 网格与工具类 ---------- */

.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid-hero { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.nowrap { white-space: nowrap; }
.num { font-family: var(--digits); font-variant-numeric: tabular-nums; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.px-20 { padding-left: 20px; padding-right: 20px; }

.detail-json {
  margin: 0; padding: 12px 14px; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: var(--font-label);
  overflow-x: auto; max-height: 340px; line-height: 1.55;
}

.pager {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  border-top: 1px solid var(--border); font-size: var(--font-body); color: var(--fg-muted); flex-wrap: wrap;
}
.pager .faint { margin-left: auto; }

/* 统一分页：统计在左，页量、页码和跳转在右，所有控件共用 32 px 高度。 */
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: var(--font-body); line-height: 20px; min-width: 0; }
.pagination-summary, .pagination-actions, .pagination-controls, .pagination-pages, .pagination-size, .pagination-jump { display: flex; align-items: center; }
.pagination-summary { flex-wrap: wrap; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.pagination-summary > :first-child { color: var(--fg); }
.pagination-range, .pagination-note, .pagination-fixed-size { color: var(--fg-faint); white-space: nowrap; }
.pagination-actions { gap: 18px; flex-wrap: wrap; margin-left: auto; min-width: 0; }
.pagination-controls, .pagination-pages { gap: 4px; }
.pagination-size { gap: 8px; white-space: nowrap; }
.pagination-size :is(select, .xs-trigger) { height: 32px; min-height: 32px; width: 90px; min-width: 90px; padding: 0 10px; font-size: var(--font-body); border-radius: 2px; }
.pagination-size .xs { width: 90px; min-width: 90px; }
.pagination-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 32px; min-width: 32px; height: 32px; padding: 0 5px; border: 1px solid transparent; border-radius: 2px; color: var(--fg-muted); background: transparent; font: inherit; font-family: var(--digits); font-variant-numeric: tabular-nums; cursor: pointer; transition: color var(--hover-duration) ease, background-color var(--hover-duration) ease, border-color var(--hover-duration) ease; }
@media (hover: hover) {
  .pagination-button:where(:not(:disabled, [aria-disabled="true"], [aria-current="page"])):hover { color: var(--hover-fg); border-color: var(--hover-border); background: var(--hover-bg); }
}
.pagination-button[aria-current="page"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.pagination-button:disabled { color: var(--fg-faint); opacity: .45; cursor: not-allowed; }
.pagination-button > svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pagination-jump { gap: 8px; margin: 0; white-space: nowrap; }
.pagination .pagination-jump-input { width: 44px; min-width: 44px; height: 32px; padding: 0 5px; border: 1px solid var(--border); border-radius: 2px; color: var(--fg); background: var(--bg-elev); font: inherit; font-family: var(--digits); text-align: center; }
.pagination-jump-input[aria-invalid="true"] { border-color: var(--fg); }
.pagination-go { width: auto; padding: 0 10px; border-color: var(--border); font-family: var(--sans); background: var(--bg-elev); }
.pagination :is(button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pagination-cursor-page { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; color: var(--accent); font-family: var(--digits); }
.pagination-status { flex: 0 0 100%; font-size: var(--font-label); }
.pagination-status:empty { display: none; }
.pagination[aria-busy="true"] .pagination-actions { opacity: .65; }
@media (max-width: 900px) {
  .pagination { gap: 10px 16px; }
  .pagination-actions { gap: 12px; }
}
@media (max-width: 650px) {
  .pagination { padding: 12px; }
  .pagination-summary { width: 100%; }
  .pagination-actions { width: 100%; margin-left: 0; justify-content: space-between; gap: 10px 12px; }
  .pagination-controls { order: 3; flex: 0 0 100%; justify-content: center; gap: 2px; }
  .pagination-controls > [data-pagination-focus="first"], .pagination-controls > [data-pagination-focus="last"] { display: none; }
  .pagination-pages { gap: 2px; }
  .pagination-button { width: 28px; min-width: 28px; height: 32px; padding-inline: 2px; }
  .pagination-jump { gap: 6px; }
  .pagination-go { width: auto; padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) { .pagination-button { transition: none; } }
@media (max-width: 380px) {
  .pagination-pages > :not(.pagination-page--near) { display: none; }
}
@media print { .pagination { display: none !important; } }

/* ---------- 页面标题、筛选与结果：按任务组成，避免任意换行 ---------- */
.breadcrumb { display: flex; align-items: center; gap: 13px; min-width: 0; color: var(--fg-muted); font-size: var(--font-label); }
.breadcrumb > span { white-space: nowrap; }
.breadcrumb-current { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; color: var(--fg); background: var(--bg-hover); border: 1px solid var(--border); border-radius: var(--radius); }
.page-heading { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 var(--page-gutter); padding: 16px 0; border-bottom: 1px solid var(--border-strong); min-width: 0; }
.page-heading-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-heading h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; }
.page-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.page-heading-actions:empty { display: none; }
.page-description { margin: 4px 0 0; color: var(--fg-muted); font-size: var(--font-body); }
.page-help { flex: none; }
.page-help summary { display: grid; place-items: center; width: 28px; height: 28px; cursor: help; list-style: none; color: var(--fg-muted); border-radius: var(--radius); }
.page-help summary::-webkit-details-marker { display: none; }
.page-help[open] summary { background: var(--bg-sunken); color: var(--fg); }
@media (hover: hover) {
  .page-help summary:hover { background: var(--hover-bg); color: var(--accent); }
}
.page-help p { position: absolute; left: 0; top: 100%; z-index: 30; width: min(420px, calc(100vw - 112px)); margin: 7px 0 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--fg-muted); box-shadow: var(--shadow-pop); font-size: var(--font-body); line-height: 1.65; }
.filter-bar { display: flex; flex-direction: column; gap: 12px; padding: 0; min-width: 0; }
.panel-body.filter-bar { padding: 16px 20px; }
.panel-body > .filter-bar:first-child, .main > .filter-bar:first-child { padding-top: 0; }
.filter-main { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; min-width: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; align-items: end; min-width: 0; }
.filter-main > *, .filter-grid > * { min-width: 0; }
.filter-main > .field { flex: 0 1 180px; max-width: 100%; }
.filter-main > .field--search { flex: 0 1 300px; }
.filter-main > .field--compact { flex: 0 1 140px; }
.filter-main > .field--range { flex: 1 1 280px; }
.filter-main > .filter-actions { margin-left: auto; }
.filter-main .field-label { line-height: 18px; font-weight: 500; }
.filter-main input:not([type="checkbox"]):not([type="radio"]), .filter-grid input:not([type="checkbox"]):not([type="radio"]), .filter-main .xs-trigger, .filter-grid .xs-trigger { width: 100%; max-width: 100%; }
.filter-main :is(input:not([type="checkbox"]):not([type="radio"]), select, .xs-trigger, .btn):not(.segmented > .btn), .filter-grid :is(input:not([type="checkbox"]):not([type="radio"]), select, .xs-trigger, .btn):not(.segmented > .btn) { height: var(--control-height); }
.filter-main :is(.btn, .xs-trigger), .filter-grid :is(.btn, .xs-trigger) { font-size: var(--font-body); box-shadow: none; }
.filter-main .segmented, .filter-grid .segmented { --segment-height: var(--control-height); align-self: flex-end; }
/* 独立切换栏按实际内容靠左，说明紧跟切换，不占用额外一行。 */
.filter-switches { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px 12px; min-width: 0; max-width: 100%; }
.filter-bar > .filter-main.filter-switches { align-items: center; justify-content: flex-start; gap: 10px 12px; }
.filter-main.filter-switches > .field--range { flex: 0 1 auto; margin-left: 0; }
.filter-switches .segmented { align-self: flex-start; max-width: 100%; }
.filter-main.target-query-grid { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(290px, 1.35fr) auto; }
.target-query-grid > .field:nth-child(2) { grid-column: 2 / -1; }
.target-query-grid > :is(.btn, .filter-actions):last-child { grid-column: 3; justify-self: end; min-width: 78px; }
@media (min-width: 1700px) {
  .filter-main.target-query-grid { grid-template-columns: minmax(180px, 1fr) minmax(290px, 1.3fr) repeat(2, minmax(210px, 1fr)) auto; }
  .target-query-grid > .field:nth-child(2) { grid-column: auto; }
  .target-query-grid > :is(.btn, .filter-actions):last-child { grid-column: auto; }
}
@media (max-width: 850px) {
  .filter-main.target-query-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .target-query-grid > .field:nth-child(2) { grid-column: auto; }
  .target-query-grid > :is(.btn, .filter-actions):last-child { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .filter-main.target-query-grid { grid-template-columns: minmax(0, 1fr); }
  .target-query-grid > :is(.btn, .filter-actions):last-child { grid-column: 1; justify-self: stretch; }
}
.filter-span-2 { grid-column: span 2; }
.filter-span-all { grid-column: 1 / -1; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-height: 36px; }
.filter-advanced { min-width: 0; border-top: 1px solid var(--border); }
.filter-advanced > summary { display: flex; align-items: center; gap: 8px; width: fit-content; padding: 10px 0; color: var(--fg-muted); font-size: var(--font-body); cursor: pointer; list-style: none; }
.filter-advanced > summary::-webkit-details-marker { display: none; }
@media (hover: hover) {
  :where(.filter-advanced, .manage-task-fold, .attacked-low, .overview-disclosure) > summary:hover { background: var(--hover-bg); color: var(--hover-fg); }
}
.filter-advanced > summary::after { content: ''; width: 6px; height: 6px; margin-left: 2px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.filter-advanced[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.filter-advanced .filter-main, .filter-advanced .filter-grid { padding-top: 4px; }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius); background: var(--accent-soft); color: var(--fg); font-family: var(--digits); }
.filter-applied, .filter-dirty { margin: 0; font-size: var(--font-body); color: var(--fg-muted); }
.filter-dirty { display: flex; align-items: center; gap: 6px; color: var(--warn); }
.result-toolbar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px 16px; min-width: 0; }
.result-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; min-width: 0; color: var(--fg-muted); font-size: var(--font-body); }
.result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.result-actions .btn:not(.segmented > .btn), .result-toolbar > .btn { height: var(--control-height-sm); }
.result-actions > .field { flex-direction: row; align-items: center; gap: 8px; }
.result-actions > .field > .field-label { font-weight: 400; white-space: nowrap; }
.result-actions > .field--compact :is(select, .xs-trigger):not(.xs-native) { width: 150px; min-width: 0; height: var(--control-height-sm); font-size: var(--font-body); }
.form-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; min-width: 0; }
.form-toolbar > .field { flex: 0 1 260px; min-width: 0; max-width: 100%; }
.form-toolbar > .field :is(input, select, .xs-trigger) { width: 100%; }
.form-toolbar > .btn { height: 36px; }
.form-toolbar > .metric-footnote { flex-basis: 100%; margin: 0; }
.bulk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-sunken); font-size: var(--font-body); }
.bulk-toolbar .result-actions { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.form-grid > textarea, .form-grid > .field-wide, .form-grid > .form-actions, .form-grid > [role="alert"], .form-grid > .metric-footnote { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
.field-error { color: var(--bad); font-size: var(--font-body); line-height: 1.5; }
.field-error:empty { display: none; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .xs-trigger[aria-invalid="true"] { border-color: var(--bad); }
.banner--muted { --notice-color: var(--accent); color: var(--fg-muted); }
.table td .btn-group { gap: 6px; }
.table td .btn--sm { height: 28px; }
.table tbody tr[aria-selected="true"] td { background: var(--accent-soft); }
.table .num, .table td.align-right, .chart-axis, .chart-tip-row b, .sharebar-value, .profile-stats strong { font-family: var(--digits); font-variant-numeric: tabular-nums; }
.table .mono, .table .align-right .mono, pre, code, .detail-json, .protection-raw, .inventory-json { font-family: var(--mono); }
.home-footer-label { color: var(--fg-muted); font-size: var(--font-label); }
.chart-axis { font-size: var(--font-caption); }
dialog { color: var(--fg); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(20 22 26 / 38%); }
dialog .panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
dialog .panel-body { padding: 20px; }
dialog .form-actions { position: sticky; bottom: 0; padding-top: 12px; padding-bottom: 0; background: var(--bg-elev); }
.login-foot { color: var(--fg-muted); }
@media (max-width: 760px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-main > .field { flex: 1 1 180px; }
  .filter-main > .field--search, .filter-main > .field--range { flex-basis: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid > * { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  :root { --page-gutter: 14px; }
  .sidebar, html[data-sidebar="collapsed"] .sidebar { width: 50px !important; flex-basis: 50px !important; padding-inline: 5px; }
  .page-heading { padding-block: 12px; align-items: flex-start; flex-wrap: wrap; }
  .page-heading h1 { font-size: 22px; }
  .page-heading-actions { justify-content: flex-start; }
  .breadcrumb { gap: 8px; }
  .breadcrumb > span:first-child, .breadcrumb > span:nth-child(2) { display: none; }
  .topbar-status { display: none; }
  .drawer { width: calc(100vw - 12px); }
  .filter-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .result-actions { margin-left: 0; }
  dialog .panel-head, dialog .panel-body { padding: 16px; }
}
@media (max-width: 480px) {
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .filter-main > .field { flex-basis: 100%; }
  .filter-main > .filter-actions { width: 100%; margin-left: 0; }
  .filter-span-2 { grid-column: 1 / -1; }
  .filter-actions .btn { flex: 1; }
}
@media (pointer: coarse) {
  :root { --control-height: 44px; --control-height-sm: 44px; }
  .btn:not(.segmented > .btn), .xs-trigger, input[type="text"], input[type="search"], input[type="password"], input[type="number"], input[type="datetime-local"], select { min-height: 44px; }
  .theme-btn { min-height: 36px; }
  .table td :is(.btn, .btn--sm) { min-height: 36px; }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  .grid-hero { grid-template-columns: 1fr; }
}

@media (max-width: 1180px) and (min-width: 901px) {
  :root { --sidebar-w: 194px; }
}
@media (max-width: 900px) {
  :root { --page-gutter: 20px; }
  .shell { flex-direction: row; }
  .sidebar, html[data-sidebar="collapsed"] .sidebar {
    width: 62px !important; flex: 0 0 62px !important; height: 100dvh;
    position: sticky; flex-direction: column; align-items: stretch;
    gap: 0; overflow: hidden; padding: 15px 8px 10px; transition: none;
  }
  .brand, html[data-sidebar="collapsed"] .brand { justify-content: center; padding: 0 0 18px; }
  .brand-mark .brand-logo { display: none; }
  .brand-mark .brand-icon { display: block; }
  .nav-group-label, .nav-label, .nav-tag, .theme-btn-label, .sidebar-user-copy { display: none !important; }
  .nav-scroll { display: block; overflow-x: hidden; overflow-y: auto; margin: 0; padding: 0; }
  .nav-group { display: block; padding: 3px 0; }
  .nav-list { flex-direction: column; gap: 3px; }
  .nav-item { justify-content: center; padding: 0; min-height: 35px; }
  .sidebar-foot { display: block; margin: auto 0 0; padding-top: 10px; }
  .sidebar-user, html[data-sidebar="collapsed"] .sidebar-user { flex-direction: column; gap: 6px; }
  .sidebar-profile { flex: none; padding: 3px; }
  .sidebar-appearance, html[data-sidebar="collapsed"] .sidebar-appearance { margin: 0 0 12px; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
  .theme-switch, html[data-sidebar="collapsed"] .theme-switch { grid-template-columns: 1fr !important; width: 100%; }
  #sidebar-toggle { display: none; }
  .topbar { padding: 12px var(--page-gutter); flex-wrap: wrap; gap: 12px; }
  .subtitle { white-space: normal; }
  .topbar-status { flex-wrap: wrap; }
  .main { padding: 16px var(--page-gutter) 28px; gap: 12px; }
  .footer { padding: 12px var(--page-gutter) 20px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .card { padding: 14px 16px 12px; }
  .card-number { font-size: 26px; }
  .grid-2 { grid-template-columns: 1fr; }
  .sharebar { grid-template-columns: minmax(100px, 160px) 1fr auto; gap: 10px; }
}

@media (max-width: 650px) {
  :root { --page-gutter: 14px; }
  .sidebar, html[data-sidebar="collapsed"] .sidebar { width: 50px !important; flex-basis: 50px !important; padding-inline: 5px; }
  .panel-head { flex-wrap: wrap; align-items: flex-start; gap: 10px; }
  .panel-head > div:first-child { flex: 1 1 100%; }
  .panel-actions { flex-wrap: wrap; max-width: 100%; }
  .panel-actions input[type="search"], .panel-search { width: min(220px, 100%); }
  .segmented > .btn { flex: 1 0 auto; }
}

@media (max-width: 560px) {
  :root { --page-gutter: 14px; }
  .status-chip--quiet { display: none; }
  .toolbar > * { flex: 1 1 100%; }
  .segmented { width: 100%; }
  .segmented > .btn { flex: 1 0 auto; }
}

/* ---------- 动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- 打印（P7 报告） ---------- */

@media print {
  .sidebar, .topbar-status, .toolbar, .form-toolbar, .form-actions, .filter-bar, .result-actions, .table-actions, .btn, .banner-slot, .icon-btn, .footer { display: none !important; }
  body { background: #fff; color: #000; }
  .topbar { position: static; border: none; padding: 0 0 12px; }
  .panel, .card { break-inside: avoid; box-shadow: none; border-color: #bbb; }
  .main { padding: 0; max-width: none; }
  a { color: #000; text-decoration: none; }
}

/* Attack event workspace: retain shared cards, tables and chart vocabulary. */
.event-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.event-filters .field { min-width: 0; }
.event-filter-actions { flex-wrap: nowrap; }
.event-filters input, .event-filters select { width: 100%; }
.event-custom-range { margin-top: 14px; }
.event-custom-range[hidden] { display: none; }
.event-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; font-size: var(--font-body); color: var(--fg-muted); margin: 12px 0; }
.event-meta details { max-width: 620px; }
.event-meta summary { cursor: pointer; color: var(--fg); }
.event-meta details p { line-height: 1.7; margin-top: 8px; }
.event-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 14px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: var(--font-body); }
.event-cell { gap: 6px; }
.event-cell a { text-decoration: none; font-weight: 600; }
.event-types { display: flex; flex-wrap: wrap; gap: 5px; max-width: 290px; }
.event-detail-cards { margin: 18px 0; }
.event-strip-legend { margin-top: 10px; font-size: var(--font-label); color: var(--fg-muted); }
.event-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--fg-muted); }
.event-key--alert { background: var(--bad); }
.event-key--ok { background: var(--ok); }
.event-key--gap { background: var(--warn); }
.event-key--pending { background: var(--accent); }
.events-detail > .panel, .events-detail > .grid-2 { margin-bottom: 18px; }
@media (max-width: 700px) { .event-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .event-meta { flex-direction: column; } }
.event-sources .table-wrap { max-height: 410px; overflow: auto; }
.event-alerts .table-wrap { max-height: 540px; overflow: auto; }
.event-sources th, .event-alerts th { position: sticky; top: 0; z-index: 1; background: var(--bg-elev); }
.events-detail { scroll-margin-top: 95px; }

.chart-band { fill: var(--warn); opacity: .10; }
.chart-band--peak { fill: var(--c-attack); opacity: .28; }
.chart-band--blackhole { fill: var(--fg); opacity: .09; }

@media (max-width: 420px) { .event-filters { grid-template-columns: minmax(0, 1fr); } }

/* ---- 存储与补数面板 ---- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 18px; }
.kpi-cell .panel-kpi { margin: 8px 0 4px; }
.kpi-cell .panel-kpi-value { font-size: 22px; }
.progress-block { margin: 14px 0 4px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--font-body); margin-bottom: 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.mono.bad { color: var(--bad); }

/* Attack report workspace and archival print layout. */
.report-controls:empty { display: none; }
.report-controls [hidden] { display: none !important; }
.report-controls > .panel + .panel { margin-top: 14px; }
.report-query-fields { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr); }
.report-custom { margin-top: 14px; }
.report-annotation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.report-annotation-grid > :nth-last-child(-n+2) { grid-column: 1 / -1; }
.report-annotation-grid textarea { width: 100%; resize: vertical; font: inherit; background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.report-annotations summary { cursor: pointer; }
.report-event-picker { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
/* 报告图表以蓝色为主，曲线、渐变、覆盖条和占比条共用系列色。 */
.report-document {
  --c-attack: var(--brand-blue);
  --c-in: var(--network-heat-4);
  --c-out: var(--network-heat-5);
  display: flex; flex-direction: column; gap: 18px; min-width: 0;
}
.report-cover { border: 1px solid var(--border); border-top: 3px solid var(--accent); background: var(--bg-elev); border-radius: var(--radius); padding: 30px; }
.report-eyebrow { font-size: var(--font-label); color: var(--fg-muted); letter-spacing: 1.7px; }
.report-cover h2 { font-size: 28px; line-height: 1.4; margin: 16px 0; overflow-wrap: anywhere; }
.report-target { font-size: 22px; margin-bottom: 12px; overflow-wrap: anywhere; }
.report-meta, .report-manual { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 14px; font-size: var(--font-body); color: var(--fg-muted); }
.report-manual span { overflow-wrap: anywhere; }
.report-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.report-section p { margin: 0; }
.report-section .table-wrap { overflow-x: auto; }
.report-section td { overflow-wrap: anywhere; }
.report-footnotes { padding: 8px 28px 20px 40px; line-height: 1.8; font-size: var(--font-body); color: var(--fg-muted); }
.report-footnotes li { margin-top: 10px; }
.report-query > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; cursor: pointer; list-style: none; }
.report-query > summary::-webkit-details-marker { display: none; }
.report-query > summary::after { content: '修改'; margin-left: auto; font-size: var(--font-body); color: var(--accent); }
.report-query[open] > summary::after { content: '收起'; }
.report-query[open] > summary { border-bottom: 1px solid var(--border); }
.report-query-summary { font-size: var(--font-body); color: var(--fg-muted); overflow-wrap: anywhere; }
.report-cover-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.report-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.report-range { margin: 0; font-size: 14px; }
.report-toc { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); font-size: var(--font-body); }
.report-toc-label { color: var(--fg-muted); margin-right: 4px; }
.report-toc a { color: var(--fg); text-decoration: none; padding: 3px 9px; border-radius: 999px; background: var(--bg-sunken); }
@media (hover: hover) {
  .report-toc a:hover { color: var(--accent); background: var(--hover-bg); text-decoration: none; }
}
.report-section { scroll-margin-top: 80px; }
.report-findings { margin: 0; padding-left: 20px; line-height: 1.8; color: var(--fg-muted); }
.report-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 0; }
.report-kv > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.report-kv span { font-size: var(--font-body); color: var(--fg-muted); }
.report-kv strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.report-coverage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 6px; }
.report-coverage { width: 100%; }
.report-coverage-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--font-body); color: var(--fg-muted); }
.report-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--muted-bg); }
.report-swatch.cell--ok { background: var(--ok); opacity: .5; }
.report-swatch.cell--alert { background: var(--c-attack); }
.report-swatch.cell--gap { background: var(--bad); }
.report-swatch.cell--outage { background: var(--warn); }
.report-swatch.cell--pending { background: var(--accent); opacity: .35; }
.report-swatch.cell--immature { background: var(--accent); opacity: .16; }
.report-swatch.cell--partial { background: var(--warn); opacity: .5; }
@media (max-width: 560px) {
 .report-kpis .card-number { font-size: 20px; white-space: normal; overflow-wrap: anywhere; }
 .report-kpis .card-value { overflow: visible; }
 .toolbar.report-controls { display: grid; grid-template-columns: 1fr 1fr; }
 .toolbar.report-controls > .metric-footnote { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
 .report-query-fields, .report-annotation-grid { grid-template-columns: 1fr; }
 .report-cover { padding: 20px; }
 .report-cover h2 { font-size: 24px; }
 .report-custom { display: grid; grid-template-columns: 1fr; }
}
@media print {
 @page { size: A4 portrait; margin: 14mm 12mm; }
 body:has(.report-document) {
  --bg: #fff; --bg-elev: #fff; --fg: #111; --fg-muted: #444; --fg-faint: #555;
  --border: #bbb; --border-strong: #999;
  --brand-blue: #2563eb; --brand-blue-strong: #1d4ed8; --brand-blue-soft: #eef4ff;
  --accent: var(--brand-blue); --accent-strong: var(--brand-blue-strong);
  --accent-soft: var(--brand-blue-soft); --accent-soft-2: #e0eaff; --accent-fg: #fff;
  --ok: var(--brand-blue); --ok-bg: var(--brand-blue-soft);
  --warn: #465b80; --warn-bg: #f0f3f8; --bad: var(--fg); --bad-bg: #e9edf5;
  --bg-sunken: #f0f2f4; --bg-hover: #f3f4f6; --sidebar-bg: #fafafa; --muted-bg: #eff0f2;
  --tip-bg: #292b2f; --tip-fg: #fff;
  --network-heat-4: #83a9fa; --network-heat-5: #608be5;
  --c-attack: var(--brand-blue); --c-in: var(--network-heat-4); --c-out: var(--network-heat-5);
  --c-cleaned: var(--brand-blue-strong); --c-policy: #416cb5; --c-single: #5e7294;
  --policy-color-1: #1d4ed8; --policy-color-2: #4f78d1; --policy-color-3: #8799b9; --policy-color-4: #202329;
  --policy-color-5: #41609b; --policy-color-6: #6f85b3; --policy-color-7: #a0b2d3; --policy-color-8: #586273;
  color-scheme: light; font-size: 10pt;
 }
 body:has(.report-document) .shell, body:has(.report-document) .content { display: block; margin: 0; width: 100%; min-height: 0; }
 body:has(.report-document) .topbar, body:has(.report-document) .page-heading, .report-controls, .report-annotations { display: none !important; }
 .report-document { display: block; }
 .report-document > * { margin-bottom: 5mm; }
 .report-cover { background: #fff; padding: 5mm; break-inside: avoid; }
 .report-document .report-section { break-inside: auto; overflow: visible; }
 .report-section .panel-head { break-after: avoid; }
 .report-section .table-wrap { overflow: visible; }
 .report-section table { width: 100%; min-width: 0; font-size: 8pt; table-layout: auto; }
 .report-section th, .report-section td { white-space: normal; padding: 2mm; }
 .report-section thead { display: table-header-group; }
 .report-section tr, .report-section .panel-body, .report-footnotes li { break-inside: avoid; }
 .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .report-chart { height: 62mm; break-inside: avoid; }
 .report-document .banner { background: #fff; color: #111; border: 1px solid #888; }
 .report-document .chart-tip { display: none; }
 .report-document * { box-shadow: none !important; print-color-adjust: exact; }
 .report-toc { display: block; border: 0; padding: 0; background: none; }
 .report-toc a { display: inline; background: none; padding: 0 3mm 0 0; color: #111; }
 .report-document > .cards { break-inside: avoid; }
 .report-document > .report-toc + .report-section { break-before: auto; }
 .report-coverage-legend, .report-findings { color: #333; }
}

/* Protection analysis: native SVG and compact, inspectable state strips. */
.protection-chart { width: 100%; overflow-x: auto; }
.protection-chart svg { min-width: 680px; display: block; }
.protection-chart [role="button"] { cursor: pointer; }
.protection-strip { display: flex; width: 100%; min-height: 20px; gap: 1px; }
.protection-cell { flex: 1 1 0; min-width: 1px; height: 20px; padding: 0; border: 0; border-radius: 2px; cursor: pointer; }
.protection-state { display: inline-block; border-radius: var(--radius); padding: 3px 7px; font-size: var(--font-label); white-space: nowrap; }
.protection-state--full { background: var(--ok-bg); color: var(--ok); }
.protection-state--no_alert { background: var(--accent-soft); color: var(--accent); }
.protection-state--no_policy, .protection-state--no_dst { background: var(--muted-bg); color: var(--fg-muted); }
.protection-state--below_floor, .protection-state--small_difference, .protection-state--multi_collector, .protection-state--unverified_direction { background: var(--warn-bg); color: var(--warn); }
.protection-state--missing, .protection-state--collector_outage, .protection-state--invalid_values { background: var(--bad-bg); color: var(--bad); }
.protection-state--immature, .protection-state--pending_seal { background: var(--accent-soft); color: var(--accent); }
.protection-cell.protection-state--full { background: var(--ok); }
.protection-cell.protection-state--below_floor, .protection-cell.protection-state--small_difference { background: var(--warn); opacity: .65; }
.protection-cell.protection-state--missing, .protection-cell.protection-state--collector_outage { background: var(--bad); }
.protection-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.protection-check { display: inline-flex; flex: none; align-items: center; gap: 8px; color: var(--fg-muted); font-size: var(--font-body); line-height: 20px; white-space: nowrap; }
.protection-check > input[type="checkbox"] { flex: 0 0 16px; width: 16px; height: 16px; margin: 0; }
.protection-notice { border-left: 3px solid var(--warn); background: var(--warn-bg); color: var(--fg); padding: 10px 14px; border-radius: var(--radius); font-size: var(--font-body); line-height: 1.7; }
.protection-columns { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.protection-policy { display: inline-flex; align-items: center; gap: 6px; }
.protection-policy i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.protection-details > summary { padding: 16px 20px; cursor: pointer; font-weight: 600; }
.protection-raw { max-height: 360px; overflow: auto; padding: 14px; background: var(--bg-sunken); font-size: var(--font-label); white-space: pre-wrap; overflow-wrap: anywhere; }
.protection-pagination { justify-content: flex-end; margin-top: 12px; }
@media (max-width: 1100px) { .protection-columns { grid-template-columns: 1fr; } }
.protection-protocol-bar { display: flex; height: 18px; overflow: hidden; border-radius: var(--radius); background: var(--bg-sunken); }
.protection-protocol-bar span { display: block; height: 100%; }
.protection-state--data_conflict { background: var(--bad-bg); color: var(--bad); }

/* Threshold notifications share the existing cards, panels and typography. */
.notify-auth { margin: 16px 0; align-items: end; }
.notify-guide { margin-top: 24px; }
.notify-guide > summary { cursor: pointer; padding: 16px 20px; font-weight: 600; }
.notify-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; color: var(--fg); background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; }
.notify-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.notify-dialog .panel-body { padding: 20px; }
.notify-dialog .field { display: flex; flex-direction: column; gap: 6px; }
.notify-dialog input:not([type=checkbox]), .notify-dialog select { width: 100%; }
.notify-check { display: flex; gap: 6px; align-items: center; }
.notify-check input { width: auto; }
.notify-channel-picker { display: grid; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.notify-filters { align-items: stretch; margin: 18px 0; }
.notify-filters .field { min-width: 135px; }
.notify-pagination { justify-content: flex-end; margin-top: 14px; }
.notify-event { display: block; margin-top: 6px; }
.notify-message { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 650px) { .notify-auth, .notify-filters { display: grid; grid-template-columns: 1fr; } .notify-dialog { max-height: calc(100vh - 24px); } }
[data-page="notify"] .tag--good { color: var(--ok); background: var(--ok-bg); }
[data-page="notify"] .tag--bad { color: var(--bad); background: var(--bad-bg); }

/* ---------- 概况：时间范围（D-028） ---------- */

.range-bar { display: flex; flex-direction: column; gap: 10px; }
.range-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.range-status { margin-left: auto; font-size: var(--font-body); color: var(--fg-faint); }
.range-custom { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.range-custom[hidden], .range-error[hidden] { display: none; }
.range-custom input[type="datetime-local"] { width: 210px; }
.range-hint { font-size: var(--font-body); color: var(--fg-faint); align-self: center; }
.range-error { margin: 0; flex-basis: 100%; font-size: var(--font-body); color: var(--bad); }
.overview-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--font-body); color: var(--fg-muted); margin-top: -6px; }
@media (max-width: 560px) {
  .range-status { margin-left: 0; flex-basis: 100%; }
  .range-custom > .field, .range-custom input[type="datetime-local"] { width: 100%; }
}

/* Asset management shares the existing panels, typography and table language. */
.inventory-dialog { width: min(1120px, 94vw); max-height: 90vh; border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--bg-elev); color: var(--fg); overflow: auto; }
.inventory-dialog::backdrop { background: rgb(0 0 0 / .45); }
.inventory-dialog .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.inventory-dialog input:not([type=checkbox]), .inventory-dialog select, .inventory-dialog textarea { width: 100%; }
.inventory-dialog textarea { min-height: 72px; resize: vertical; font: inherit; }
.inventory-dialog form.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.inventory-dialog form.stack > .metric-footnote, .inventory-dialog form.stack > [role=alert], .inventory-dialog form.stack > .toolbar { grid-column: 1 / -1; }
.inventory-filters { align-items: stretch; }
.inventory-json { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 720px; max-height: 420px; overflow: auto; }
.inventory-pagination { justify-content: flex-end; }
.inventory-ownership { margin-block: 16px; }
@media(max-width: 700px) { .inventory-dialog form.stack { grid-template-columns: 1fr; } }
@media print { .inventory-ownership { break-inside: auto; } }

.inventory-auth input[type="password"], .inventory-dialog textarea { background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 11px; }
.inventory-auth input[type="password"] { height: 36px; }
.inventory-filters input[name="q"] { width: 100%; max-width: 100%; }

/* 长列表折叠（来源 IP 等）：默认只显示前 N 行 */
details.fold { border-top: 1px solid var(--border); }
details.fold > summary { padding: 10px 16px; cursor: pointer; color: var(--accent); font-size: var(--font-body); }
details.fold[open] > summary { color: var(--fg-muted); }
.report-conclusion { line-height: 1.8; font-size: 15px; }
.health-link { text-decoration: none; }
@media (hover: hover) {
  .health-link:hover { text-decoration: underline; text-underline-offset: 2px; }
}
.slow-sql { display: block; max-width: 640px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--font-body); }

/* 右侧抽屉（事件详情） */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 22, 0.38); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(800px, calc(100vw - 24px)); background: var(--bg-elev); border-left: 1px solid var(--border); box-shadow: -8px 0 28px rgb(0 0 0 / 10%); z-index: 41; overflow-y: auto; overscroll-behavior: contain; }
.drawer-body { padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 16px; }
body.drawer-open { overflow: hidden; }
@media (max-width: 640px) { .drawer-body { padding: 12px 16px 24px; } }
details.fold-panel > summary { padding: 14px 20px; cursor: pointer; font-weight: 600; }

/* 网段峰值：完整地址、小方格渐变条与原始峰值；小格只作峰值视觉编码。 */
.networks-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.network-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.networks-page .network-filters { padding: 0; }
.network-filters > .filter-main { gap: 12px 24px; }
.network-filters > .filter-main > .field--range { flex: 0 1 auto; }
.network-updates { --control-height-sm: var(--control-height); margin-left: auto; justify-content: flex-end; }
.network-updates .result-summary { font-size: var(--font-label); }
.network-updates > .btn { flex: none; }
.network-result { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.network-summary { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; }
.network-summary-stats { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; }
.network-alert-total { display: inline-flex; align-items: baseline; gap: 5px; color: var(--fg-muted); font-size: var(--font-body); }
.network-alert-total > strong { color: var(--fg); font-size: var(--font-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.network-alert-total.has-alert > strong { color: var(--accent); }
.network-total { padding-left: 16px; border-left: 1px solid var(--border); color: var(--fg-muted); font-size: var(--font-body); }
.network-window { color: var(--fg-muted); font-size: var(--font-label); }
.network-coverage { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--border); background: var(--bg-sunken); color: var(--fg-muted); font-size: var(--font-label); }
.network-coverage-detail { flex: 1 1 320px; min-width: 0; }
.network-coverage > a { margin-left: auto; }
.network-detail-note { margin: 0; color: var(--fg-muted); font-size: var(--font-label); }
/* 实时模式下明细（小时汇总）与上方 15 分钟网格的统计区间不同：放在明细最上方的醒目提示条，
   格子「无告警」而明细有攻击峰值时用警示色，避免被读成两处数据矛盾。 */
.network-detail-note--callout, .network-detail-note--mismatch { padding: 9px 12px; border: 1px solid var(--border); border-left-width: 3px; background: var(--bg-sunken); line-height: 1.5; }
.network-detail-note--callout { border-left-color: var(--accent); }
.network-detail-note--mismatch { border-color: var(--warn); background: var(--warn-bg); color: var(--fg); }
.network-detail-note--mismatch > strong { font-weight: 600; }
.network-heatmap { container: network-map / inline-size; min-width: 0; border-block: 1px solid var(--border); background: var(--bg-elev); }
.network-map-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.network-map-head > .panel-title { margin: 0; font-size: var(--font-body); font-weight: 600; }
.heat-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--fg-muted); font-size: var(--font-caption); }
.network-legend-metric { margin-right: 6px; }
.network-legend-scale { display: inline-flex; gap: 3px; }
.heat-legend-cell { display: block; width: 8px; height: 8px; background: var(--heat-color); }
.network-map-key { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; white-space: nowrap; }
.network-map-marker { display: inline-block; width: 12px; height: 10px; border: 1px solid var(--border-strong); background: var(--bg-elev); border-radius: 1px; }
.network-map-marker--quiet { border-style: dashed; }
.network-map-marker--missing { background: repeating-linear-gradient(45deg, var(--bg-sunken), var(--bg-sunken) 2px, var(--bg-elev) 2px, var(--bg-elev) 4px); }
.network-map-marker--blackhole { border: 2px solid var(--fg); }
.network-map-body { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 28px; padding: 18px 16px; }
.heat-groups { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.heat-group { display: grid; gap: 6px; min-width: 0; }
.heat-group-label { display: flex; align-items: baseline; gap: 10px; padding: 8px 6px 0; color: var(--fg-muted); font-size: var(--font-caption); overflow-wrap: anywhere; }
.heat-group-label > .mono { color: var(--fg); font-size: var(--font-label); }
.heat-grid { display: grid; gap: 4px; min-width: 0; }
.heat-cell { display: grid; grid-template-columns: 180px minmax(80px, 1fr) 90px; align-items: center; gap: 16px; position: relative; width: 100%; min-height: 36px; padding: 7px 6px; border: 0; border-radius: 2px; background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.heat-cell-label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--font-label); font-variant-numeric: tabular-nums; }
.heat-cell-label > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.heat-cell-swatch { position: relative; width: 8px; height: 8px; flex: none; border: 1px solid var(--heat-color); background: var(--heat-color); }
.heat-cell--quiet .heat-cell-swatch { border: 1px dashed var(--border-strong); }
.heat-cell--blackhole .heat-cell-swatch { outline: 1px solid var(--fg); outline-offset: 2px; }
.heat-cell-track { display: block; width: round(down, 100%, 11px); height: 8px; min-width: 0; background: var(--bg-sunken); mask-image: repeating-linear-gradient(90deg, #000 0 8px, transparent 8px 11px); }
.heat-cell-fill { display: block; width: round(nearest, var(--fill-width), 11px); height: 100%; min-width: 8px; background: linear-gradient(90deg, var(--network-heat-1), var(--heat-color)); }
.heat-cell-value { font-family: var(--digits); font-size: var(--font-body); font-weight: 400; text-align: right; white-space: nowrap; }
@media (hover: hover) {
  .heat-cell:where(:not(:disabled, [aria-disabled="true"], .is-selected)):hover { background: var(--hover-bg); }
}
.heat-cell.is-selected { background: var(--accent-soft); }
.heat-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; z-index: 1; }
.heat-cell-blackhole-mark { position: absolute; top: 1px; right: 1px; width: 3px; height: 3px; background: var(--fg); }
.network-heatmap [data-level="0"] { --heat-color: var(--border-strong); }
.network-heatmap [data-level="1"] { --heat-color: var(--network-heat-1); }
.network-heatmap [data-level="2"] { --heat-color: var(--network-heat-2); }
.network-heatmap [data-level="3"] { --heat-color: var(--network-heat-3); }
.network-heatmap [data-level="4"] { --heat-color: var(--network-heat-4); }
.network-heatmap [data-level="5"] { --heat-color: var(--network-heat-5); }
.network-heatmap [data-level="6"] { --heat-color: var(--network-heat-6); }
.network-heatmap [data-level="7"] { --heat-color: var(--network-heat-7); }
.network-heatmap [data-level="missing"] { --heat-color: var(--border-strong); }
/* 有上报、没有告警：空轨道 + 虚线色块，文字「无告警」；斜纹只留给真正没有数据的网段。 */
.network-heatmap [data-level="quiet"] { --heat-color: var(--border-strong); }
.heat-cell:is([data-level="0"], [data-level="missing"], [data-level="quiet"]) .heat-cell-fill { display: none; }
.heat-cell[data-level="quiet"] .heat-cell-swatch { border: 1px dashed var(--border-strong); background: transparent; }
.heat-cell:is([data-level="quiet"], [data-level="missing"]) .heat-cell-value { color: var(--fg-muted); }
.heat-cell[data-level="missing"] :is(.heat-cell-track, .heat-cell-swatch) { background: repeating-linear-gradient(45deg, var(--bg-sunken), var(--bg-sunken) 3px, var(--bg-elev) 3px, var(--bg-elev) 6px); }
.network-heat-ranking { min-width: 0; padding-left: 24px; border-left: 1px solid var(--border); }
.network-heat-ranking > h3 { margin: 0 0 12px; color: var(--fg-muted); font-size: var(--font-label); font-weight: 500; }
.network-rank-list { list-style: none; margin: 0; padding: 0; }
.network-rank { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 10px 4px; border: 0; background: transparent; color: var(--fg); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius); }
.network-rank-index { color: var(--fg-faint); font-size: var(--font-caption); font-variant-numeric: tabular-nums; }
.network-rank-net { font-size: var(--font-label); overflow-wrap: anywhere; }
.network-rank-value { color: var(--fg-muted); font-size: var(--font-label); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .network-rank:where(:not(:disabled, [aria-disabled="true"], .is-selected)):hover { background: var(--hover-bg); }
}
.network-rank.is-selected .network-rank-net { color: var(--accent); }
.network-map-caption { margin: 0; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: var(--font-label); }
.network-detail { scroll-margin-top: 80px; margin-top: 8px; padding-top: 24px; border-top: 1px solid var(--border); gap: 20px; }
.network-detail:empty { display: none; }
.network-detail > .section-head { margin: 0; flex-wrap: wrap; gap: 12px; }
.network-detail > .section-head .section-dot, .network-detail > .section-head .section-rule { display: none; }
.network-detail > .section-head .section-label { color: var(--fg); font-size: 16px; white-space: normal; overflow-wrap: anywhere; }
.network-detail > .section-head .section-side { margin-left: auto; flex-wrap: wrap; white-space: normal; }
.network-detail > .panel > .panel-head { padding-block: 16px; border-bottom: 1px solid var(--border); background: var(--sidebar-bg); }
@container network-map (max-width: 850px) {
  .network-map-body { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .network-heat-ranking { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .network-heat-ranking > h3 { margin-bottom: 6px; }
  .network-rank-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 4px 16px; }
}
@container network-map (max-width: 500px) {
  .network-map-head { padding-inline: 12px; }
  .network-map-body { padding-inline: 12px; }
  .heat-cell { grid-template-columns: minmax(0, 1fr) 82px; gap: 8px 12px; padding-block: 10px; }
  .heat-cell-label { grid-column: 1 / -1; }
  .heat-group-label { flex-wrap: wrap; gap: 4px 10px; }
  .network-map-key { margin-left: 4px; }
  .network-map-caption { padding-inline: 12px; }
}
@media (pointer: coarse) { .heat-cell { min-height: 44px; } }
@media (max-width: 650px) {
  .network-controls { gap: 12px; padding-bottom: 12px; }
  .network-filters { width: 100%; }
  .network-filters > .filter-main { gap: 12px; }
  .network-filters .segmented { max-width: 100%; flex-wrap: wrap; }
  .network-updates { width: 100%; margin-left: 0; justify-content: space-between; }
  .network-updates .result-summary { flex: 1; font-size: var(--font-caption); }
  .network-summary, .network-summary-stats { gap: 10px 16px; }
  .network-total { padding-left: 0; border-left: 0; }
  .network-detail { margin-top: 4px; padding-top: 20px; }
}

/* 概况：Top 攻击与日 × 小时热力 */
.top-events { list-style: decimal; padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.top-events li { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; }
.top-events-peak { text-align: right; font-weight: 600; color: var(--c-attack); font-variant-numeric: tabular-nums; }
.top-events li .faint { grid-column: 1 / -1; font-size: var(--font-body); }
.dayhour { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.dayhour-row { display: grid; grid-template-columns: 44px repeat(24, minmax(10px, 1fr)); gap: 3px; align-items: center; min-width: 360px; }
.dayhour-head span { font-size: var(--font-caption); }
.dayhour-day { font-size: var(--font-label); color: var(--fg-muted); }
.dayhour-cell { height: 16px; border-radius: 3px; background: var(--bg-sunken); }
.dayhour-cell--quiet { background: var(--bg-sunken); }
.dayhour-cell--none { background: repeating-linear-gradient(45deg, var(--bg-sunken), var(--bg-sunken) 2px, var(--bg-elev) 2px, var(--bg-elev) 4px); }

/* 攻击事件：攻击活动与时间轴 */
.activity-list { display: flex; flex-direction: column; }
.activity { border-top: 1px solid var(--border); }
.activity > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; }
.activity-ip { font-weight: 600; min-width: 130px; }
.activity-peak { color: var(--c-attack); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 90px; }
.gantt { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.gantt-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; min-width: 480px; }
.gantt-label { font-size: var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 18px; background: var(--bg-sunken); border-radius: 3px; }
.gantt-axis .gantt-track { background: none; height: 16px; }
.gantt-tick { position: absolute; transform: translateX(-50%); font-size: var(--font-caption); color: var(--fg-faint); white-space: nowrap; }
.gantt-tick:first-child { transform: none; }
.gantt-tick:last-child { transform: translateX(-100%); }
.gantt-bar { position: absolute; top: 2px; bottom: 2px; border: 0; padding: 0; border-radius: 3px; background: var(--c-attack); opacity: .75; cursor: pointer; }
.gantt-bar--open { opacity: 1; box-shadow: 0 0 0 1px var(--bad); }
.gantt-bar:hover { opacity: 1; }

/* 黑洞 */
.blackhole-mode { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.blackhole-mode-badge { font-size: var(--font-body); padding: 4px 10px; }
.blackhole-badge { text-decoration: none; white-space: nowrap; }
.blackhole-policy-form { align-items: flex-end; }
.blackhole-whitelist { width: 100%; font-family: var(--font-mono, monospace); font-size: var(--font-body); }
.card-link { text-decoration: none; color: inherit; display: block; }

/* ==========================================================================
   表单控件：统一自绘（下拉框见 select.js，原生 <select> 留作数据源并视觉隐藏）
   ========================================================================== */
/* 筛选栏里的用户选择：搜索框与下拉拼成一个控件，共用中间那条边框。 */
.user-picker--compact { display: flex; min-width: 0; }
.user-picker--compact > input { flex: 1 1 0; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.user-picker--compact > .xs-trigger { flex: 1 1 0; min-width: 0; margin-left: -1px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.user-picker--compact > :is(input, .xs-trigger):is(:focus, :focus-visible, .is-open, [aria-invalid="true"]) { position: relative; z-index: 1; }
.xs-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; overflow: hidden; clip-path: inset(50%); }
.xs-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-width: 120px; height: var(--control-height); padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--fg); font: inherit; font-size: var(--font-body); line-height: 20px; text-align: left; cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 24, 39, .02);
  transition: border-color var(--hover-duration) ease, box-shadow var(--hover-duration) ease, background-color var(--hover-duration) ease;
}
@media (hover: hover) {
  .xs-trigger:where(:not(:disabled, [aria-disabled="true"], .is-open)):hover { border-color: var(--hover-border); background: var(--hover-bg); }
}
.xs-trigger:focus-visible, .xs-trigger.is-open { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.xs-trigger:disabled { opacity: .55; cursor: not-allowed; }
.xs-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.xs-arrow { flex: none; width: 14px; height: 14px; fill: none; stroke: var(--fg-faint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.xs-trigger.is-open .xs-arrow { transform: rotate(180deg); stroke: var(--accent); }
.xs-list {
  position: fixed; z-index: 100; margin: 0; padding: 4px; list-style: none;
  max-height: 300px; max-width: min(420px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); font-size: var(--font-body);
  animation: xs-in .12s ease-out;
}
@keyframes xs-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.xs-option { position: relative; padding: 7px 28px 7px 10px; border-radius: var(--radius-xs); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xs-option.is-active:where(:not([aria-disabled="true"])) { background: var(--hover-bg); }
.xs-option[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.xs-option[aria-selected="true"]::after {
  content: ""; position: absolute; right: 10px; top: 50%; width: 10px; height: 5px; margin-top: -4px;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg);
}
.xs-option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .xs-list { animation: none; } .xs-arrow { transition: none; } }

/* 文本类输入：与下拉框同一套高度、圆角、边框、焦点环 */
input[type="password"], input[type="email"], input[type="url"], input[type="tel"], input[type="date"], input[type="time"], input:not([type]) {
  height: var(--control-height); padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--fg); min-width: 0; width: 100%; font-size: var(--font-body);
  transition: border-color .12s ease, box-shadow .12s ease;
}
input[type="text"], input[type="search"], input[type="number"], input[type="datetime-local"] { font-size: var(--font-body); }
@media (hover: hover) {
  :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select):where(:not(:disabled, [readonly], :focus, [aria-invalid="true"], .is-invalid)):hover { border-color: var(--hover-border); }
}
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; background: var(--bg-sunken); }
input[readonly] { background: var(--bg-sunken); color: var(--fg-muted); }
textarea {
  width: 100%; min-height: 72px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--fg); font: inherit; font-size: var(--font-body); line-height: 1.55; resize: vertical;
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea::placeholder { color: var(--fg-faint); }

/* 数字框：去掉浏览器的上下箭头，等宽数字 */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* 日期时间：日历图标跟随主题色 */
input[type="datetime-local"], input[type="date"], input[type="time"] { font-variant-numeric: tabular-nums; color-scheme: light; }
:root[data-theme="dark"] input[type="datetime-local"], :root[data-theme="dark"] input[type="date"], :root[data-theme="dark"] input[type="time"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="datetime-local"], :root:not([data-theme="light"]) input[type="date"], :root:not([data-theme="light"]) input[type="time"] { color-scheme: dark; }
}
input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
input::-webkit-calendar-picker-indicator:hover { opacity: .9; }

/* 复选框与单选框 */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px;
  border: 1.5px solid var(--border-strong); background: var(--bg-elev); cursor: pointer;
  display: inline-grid; place-content: center; transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
input[type="checkbox"] { border-radius: 4px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before {
  content: ""; width: 8px; height: 4px; margin-top: -2px; border-left: 2px solid var(--accent-fg); border-bottom: 2px solid var(--accent-fg);
  transform: rotate(-45deg) scale(0); transition: transform .1s ease;
}
input[type="radio"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-fg); transform: scale(0); transition: transform .1s ease; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
input[type="radio"]:checked::before { transform: scale(1); }
@media (hover: hover) {
  :is(input[type="checkbox"], input[type="radio"]):where(:not(:disabled, :checked)):hover { border-color: var(--hover-border); background: var(--hover-bg); }
}
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .5; cursor: not-allowed; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { display: inline-flex; align-items: center; cursor: pointer; font-size: var(--font-body); }

/* 分组框 */
fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px 12px; margin: 0; min-width: 0; }
legend { padding: 0 6px; font-size: var(--font-label); font-weight: 560; color: var(--fg-muted); }
/* 原来按 select 设的宽度同样作用于自绘触发按钮 */
.attacked-toolbar .xs-trigger { max-width: 230px; }
@media (max-width: 720px) { .attacked-toolbar .xs-trigger { max-width: 100%; } }
.panel-actions .xs-trigger { width: auto; min-width: 140px; }

/* 登录页：全屏动画与登录表单分栏。 */
.login-body {
  --login-muted: #46566a;
  --login-input-bg: #f2f2f4;
  --login-placeholder: #747984;
  --login-dot: rgb(77 102 139 / 14%);
  --login-divider-color: var(--border);
  --login-blue: #3067ed;
  --login-radius: 2px;
  --login-control-height: 48px;
  height: auto;
  background: #e5e9ee url('../login/defense-ground.png') center / cover no-repeat;
  color: #1d2b3e;
}
:root[data-theme="dark"] .login-body {
  --login-muted: var(--fg-muted);
  --login-input-bg: var(--bg-sunken);
  --login-placeholder: var(--fg-faint);
  --login-dot: rgb(149 170 200 / 16%);
  --login-divider-color: color-mix(in srgb, var(--fg-muted) 38%, var(--bg));
  background: var(--bg);
  color: var(--fg);
}
.login-shell {
  --login-toolbar-height: 56px;
  display: grid; grid-template-columns: minmax(0, 1fr) 640px;
  min-height: 100vh; min-height: 100svh;
}
.login-scene { position: relative; min-height: 0; }
.login-media, .login-art, .login-film { position: absolute; inset: 0; }
.login-media { overflow: hidden; }
.login-art, .login-film { width: 100%; height: 100%; object-fit: cover; object-position: 25% 50%; }
.login-art--light, .login-logo.login-logo--light { display: var(--logo-light-display); }
.login-art--dark, .login-logo.login-logo--dark { display: var(--logo-dark-display); }
.login-film { opacity: 0; }
.login-film.has-frame { opacity: 1; }
.login-brand, .login-card-toolbar {
  position: absolute; inset-block-start: 0;
  display: flex; align-items: center; block-size: var(--login-toolbar-height);
}
.login-brand { inset-inline-start: clamp(28px, 2.5vw + 12px, 48px); }
.login-logo { display: block; width: clamp(96px, 9vw, 132px); height: auto; }
.login-card {
  --login-section-gap: clamp(24px, 4svh, 38px);
  --login-divider-gap: 30px;
  --login-divider: repeating-linear-gradient(to right, var(--login-divider-color) 0 7px, transparent 7px 14px);
  --login-foot-padding: clamp(14px, 2.5svh, 24px);
  --login-edge-space: max(var(--login-toolbar-height), calc(2 * var(--login-foot-padding) + 1.5 * var(--font-body)));
  position: relative; isolation: isolate;
  display: grid; grid-template-rows: minmax(var(--login-edge-space), 1fr) auto minmax(var(--login-edge-space), 1fr);
  justify-items: center; row-gap: var(--login-section-gap);
  min-width: 0; padding-inline: 24px;
  background: var(--bg);
}
.login-card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, var(--login-dot) .8px, transparent 1.15px) 0 0 / 12px 12px;
  mask-image: radial-gradient(ellipse at center, transparent 15%, rgb(0 0 0 / 35%) 50%, #000 88%);
}
.login-card-toolbar {
  inset-inline: 24px; justify-content: space-between; gap: 12px;
  background: var(--login-divider) left bottom / 100% 1px no-repeat;
}
.login-card-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--login-muted); font-size: var(--font-label); font-weight: 600;
}
.login-card-label svg {
  width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.login-theme-toggle {
  --theme-thumb-offset: 34px;
  --theme-bloom-size: 6px;
  --theme-track: linear-gradient(155deg, rgb(255 255 255 / 72%), rgb(223 228 231 / 67%));
  --theme-track-border: rgb(116 128 136 / 28%);
  --theme-track-shadow: inset 0 0 0 1px rgb(255 255 255 / 90%),
    inset 0 1px 5px rgb(90 101 110 / 13%), 0 2px 4px rgb(69 80 87 / 13%);
  --theme-thumb: radial-gradient(ellipse 80% 42% at 34% 0%, rgb(255 255 255 / 98%), transparent 92%),
    linear-gradient(162deg, rgb(255 255 255 / 64%), rgb(255 255 255 / 26%) 52%, rgb(255 255 255 / 80%));
  --theme-thumb-border: rgb(108 119 126 / 36%);
  --theme-thumb-shadow: inset 0 0 0 1px #fff, inset 0 -3px 4px rgb(112 123 132 / 17%),
    0 1px 2px rgb(62 73 81 / 23%), 0 2px var(--theme-bloom-size) rgb(62 73 81 / 14%);
  --theme-glyph: #4f5c66;
  position: relative; flex: none; width: 72px; height: 38px; padding: 0;
  border: 1px solid var(--theme-track-border); border-radius: 12px;
  background: var(--theme-track);
  box-shadow: var(--theme-track-shadow);
  cursor: pointer;
  transition: border-color 260ms ease;
}
:root[data-theme="dark"] .login-theme-toggle {
  --theme-thumb-offset: 0px;
  --theme-track: linear-gradient(155deg, #08090c, #151720);
  --theme-track-border: #101116;
  --theme-track-shadow: inset 0 0 3px rgb(0 0 0 / 16%);
  --theme-thumb: radial-gradient(ellipse at 50% 109%, #7189f5, transparent 67%), linear-gradient(#42454e, #252833);
  --theme-thumb-border: #535869;
  --theme-thumb-shadow: inset 0 -2px 1px #d6e1ff,
    0 0 var(--theme-bloom-size) rgb(110 138 255 / 32%);
  --theme-glyph: #f6f7ff;
}
.login-theme-toggle:hover { --theme-bloom-size: 8px; }
.login-theme-thumb {
  position: absolute; inset-block: 0; left: 2px; margin-block: auto;
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--theme-thumb-border); border-radius: 9px;
  color: var(--theme-glyph); background: var(--theme-thumb);
  box-shadow: var(--theme-thumb-shadow);
  transform: translateX(var(--theme-thumb-offset));
  transition: transform 420ms cubic-bezier(.2, .75, .25, 1), border-color 260ms ease,
    color 260ms ease, box-shadow 260ms ease;
}
.login-theme-thumb svg { width: 17px; height: 17px; }
.login-theme-thumb g {
  transform-origin: center;
  transition: opacity 200ms ease, transform 320ms cubic-bezier(.2, .75, .25, 1);
}
:root:not([data-theme="dark"]) .login-theme-moon,
:root[data-theme="dark"] .login-theme-sun {
  opacity: 0; transform: rotate(-28deg) scale(.55);
}
@media (prefers-reduced-motion: reduce) {
  .login-theme-toggle, .login-theme-thumb, .login-theme-thumb g { transition: none; }
}
.login-card-content {
  grid-row: 2; display: grid; gap: clamp(16px, 3svh, 28px);
  width: min(100%, 450px); padding-block: 8px;
}
.login-heading { display: grid; text-align: center; }
.login-heading h1 { margin: 0; font-size: 1.875rem; line-height: 1.25; font-weight: 650; }
.login-heading > p {
  margin: 8px 0 0; padding-bottom: var(--login-divider-gap);
  background: var(--login-divider) left bottom / 100% 1px no-repeat;
  color: var(--login-muted); font-size: var(--font-body); line-height: 1.5; text-wrap: balance;
}
.login-capabilities {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  margin: var(--login-divider-gap) 0 0; padding: 0; list-style: none;
}
.login-capabilities li {
  display: grid; justify-items: center; align-content: start; gap: 4px;
  padding: 10px 4px; border: 1px solid var(--border); border-radius: var(--login-radius);
  background: color-mix(in srgb, var(--fg) 2.5%, var(--bg));
}
.login-capabilities strong { font-size: var(--font-label); font-weight: 600; line-height: 1.35; }
.login-capabilities span { color: var(--login-muted); font-size: var(--font-caption); line-height: 1.4; }
.login-capabilities svg {
  width: 18px; height: 18px; margin-bottom: 2px; fill: none; stroke: var(--accent);
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.login-form { display: grid; gap: var(--login-divider-gap); }
.login-control { position: relative; }
.login-control svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}
.login-form input {
  display: block; width: 100%; height: var(--login-control-height); padding: 0 14px;
  font: inherit; font-size: 1rem; color: var(--fg); background: var(--login-input-bg);
  border: 1px solid transparent; border-radius: var(--login-radius);
}
.login-form input[name="password"] { padding-right: 46px; }
.login-form input::placeholder { color: var(--login-placeholder); font-size: var(--font-body); opacity: 1; }
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.login-form input[aria-invalid="true"] { border-color: #c24d45; }
.login-visibility {
  position: absolute; inset: 1px 1px 1px auto; display: grid; place-items: center;
  width: 44px; padding: 0; border: 0; border-radius: var(--login-radius); background: transparent;
  color: var(--login-muted); cursor: pointer;
}
.login-visibility:hover, .login-visibility[aria-pressed="true"] { color: var(--accent); }
.login-visibility[aria-pressed="true"] .login-eye-slash { display: none; }
.login-actions {
  display: grid; padding-top: var(--login-divider-gap);
  background: var(--login-divider) left top / 100% 1px no-repeat;
}
.login-form .login-submit {
  width: 100%; min-height: var(--login-control-height); height: auto;
  border-radius: var(--login-radius);
  font-size: 1rem; font-weight: 600; background: var(--login-blue); border-color: var(--login-blue); color: #fff;
}
.login-form .login-submit:where(:not(:disabled, .is-busy)):hover { background: #2057d8; border-color: #2057d8; }
.login-error { --notice-color: var(--bad); --notice-icon: url('/static/icons/feedback-error.svg'); position: relative; margin: 0; padding: 10px 12px 10px 40px; color: var(--fg); font-size: var(--font-body); line-height: 20px; background: color-mix(in srgb, var(--notice-color) 3%, var(--bg-elev)); border: 1px solid color-mix(in srgb, var(--notice-color) 14%, var(--bg-elev)); border-radius: var(--login-radius); overflow-wrap: anywhere; }
.login-foot {
  grid-row: 3; align-self: end; justify-self: stretch;
  margin: 0; padding-block: var(--login-foot-padding);
  background: var(--login-divider) left top / 100% 1px no-repeat;
  color: var(--login-muted); font-size: var(--font-body); line-height: 1.5; text-align: center;
}
@media (max-width: 960px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .login-scene { min-height: clamp(190px, 33svh, 300px); }
  .login-art, .login-film { object-position: 33% 48%; }
  .login-card {
    --login-section-gap: 24px; --login-divider-gap: clamp(20px, 3.4svh, 30px);
    grid-template-rows: 30px 1fr auto; padding-block-start: 24px;
  }
  .login-card-content { align-self: center; }
  .login-heading h1 { font-size: 1.625rem; }
}
@media (width > 960px) and (max-height: 560px) {
  .login-body { --login-control-height: 44px; }
  .login-card { --login-section-gap: 16px; --login-divider-gap: 16px; }
}

/* 侧栏：账号整体进入个人中心，退出为独立操作，不随名称换行。 */
.sidebar-user { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sidebar-profile { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 4px; border-radius: var(--radius-xs); color: var(--fg); }
@media (hover: hover) {
  .sidebar-profile:hover { background: var(--hover-bg); text-decoration: none; }
}
.sidebar-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-elev); color: var(--fg-muted); }
.sidebar-avatar svg, .sidebar-logout svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-user-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; line-height: 1.45; }
.sidebar-user-name { font-size: var(--font-body); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: var(--font-caption); color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-logout { display: grid; place-items: center; width: 28px; height: 32px; flex: none; padding: 0; border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--fg-muted); cursor: pointer; }
@media (hover: hover) {
  .sidebar-logout:where(:not(:disabled)):hover { background: var(--hover-bg); color: var(--hover-fg); }
}
@media (max-width: 900px) { .sidebar-user-copy { display: none; } }
.account-form { max-width: 420px; }

/* 用户管理 */
.field-hint { font-size: var(--font-body); color: var(--fg-muted); line-height: 1.5; max-width: 560px; }
.accounts-create { align-items: flex-start; }
.accounts-create .field { min-width: 180px; flex: 1 1 180px; }
.input-with-btn { display: flex; gap: 6px; }
.input-with-btn input { font-family: var(--font-mono, monospace); }
.accounts-actions { gap: 6px; }
.accounts-bulk { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.btn--danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
@media (hover: hover) {
  .btn--danger:where(:not(:disabled, [aria-disabled="true"], .is-busy)):hover { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
}
.audit-detail { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; line-height: 1.45; }
.audit-detail--bad { color: var(--bad); }
.audit-detail-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.audit-detail-sub { overflow-wrap: anywhere; }
.audit-action { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.audit-target { display: inline-block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.audit-table .table { table-layout: fixed; min-width: 920px; }
.audit-table .table :is(th, td):nth-child(1) { width: 96px; white-space: nowrap; }
.audit-table .table :is(th, td):nth-child(2) { width: 100px; }
.audit-table .table :is(th, td):nth-child(3) { width: 210px; }
.audit-table .table :is(th, td):nth-child(4) { width: 180px; }
.audit-table .table :is(th, td):nth-child(6) { width: 130px; white-space: nowrap; }
.audit-table .table td:is(:nth-child(2), :nth-child(4)) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-table .table td:nth-child(5) { white-space: normal; }
.audit-target { max-width: 100%; }
.audit-table .table .cell-two > .cell-main { font-weight: 500; }
.my-badges { gap: 6px; }

/* 管理员预览用户门户 */
.preview-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.preview-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px 12px; margin-left: auto; }
.preview-tabs a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.preview-tabs a[aria-current="page"] { font-weight: 700; text-decoration: none; }
@media print { .preview-banner { display: none !important; } }

/* 用户管理：筛选与详情 */
.accounts-filter { align-items: stretch; }
.accounts-filter .toolbar-grow { min-width: 220px; }
.ua { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* 个人中心 */
.profile-head .panel-body { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.profile-avatar { width: 56px; height: 56px; border-radius: var(--radius); display: grid; place-items: center; flex: none; font-size: 22px; font-weight: 650; color: var(--accent-fg); background: var(--accent); }
.profile-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.profile-name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 18px; font-weight: 650; }
.profile-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.profile-stats > div { display: flex; flex-direction: column; gap: 3px; }
.profile-stats span { font-size: var(--font-body); color: var(--fg-muted); }
.profile-stats strong { font-size: 14px; font-weight: 600; }
.profile-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 24px; margin: 0; }
.profile-info dt { font-size: var(--font-body); color: var(--fg-muted); padding-top: 12px; }
.profile-info dd { margin: 4px 0 0; padding-bottom: 12px; border-bottom: 1px dashed var(--border); font-size: 14px; overflow-wrap: anywhere; }
.security-grid { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 20px 32px; align-items: start; }
.security-item { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunken); }
.security-title { font-weight: 600; }
.pw-row { display: flex; align-items: center; gap: 10px; }
.pw-row input { flex: 1; min-width: 0; }
@media (max-width: 760px) { .security-grid { grid-template-columns: 1fr; } }

/* 窄屏分节标题允许换行（原随演示条一起加载，独立出来保持同样的窄屏排版）。 */
@media (max-width: 650px) {
  .section-head { flex-wrap: wrap; align-items: flex-start; }
  .section-side { max-width: 100%; flex-wrap: wrap; white-space: normal; }
}

/* Shared asset/IP defense detail: the table scrolls inside the dialog on phones. */
.defense-net-dialog { width: min(1200px, 94vw); }
.defense-net-dialog .panel-body, .defense-net-dialog .stack { min-width: 0; }
.defense-net-dialog .form-toolbar { flex-wrap: wrap; }
.defense-net-dialog .pagination { max-width: 100%; }

.defense-net-dialog .defense-only { display: inline-flex; align-items: center; gap: 8px; }
.defense-net-dialog .form-toolbar input[type=checkbox] { width: 16px; height: 16px; min-width: 16px; padding: 0; }
