.anomaly-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
.anomaly-metrics .metric { padding:10px 20px; border-right:1px solid var(--line); }
.anomaly-metrics .metric:last-child { border-right:0; }
.anomaly-metrics .metric b { display:block; font-size:30px; line-height:1.4; }
.anomaly-metrics small { display:block; color:var(--muted); font-size:12px; }
.anomaly-overview { margin-bottom:18px; }
.anomaly-overview .anomaly-metrics { margin:0; padding:14px 0; }
.anomaly-overview-categories { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; padding:0 20px; }
.anomaly-overview-category { border:1px solid var(--line); border-radius:6px; padding:8px; min-width:0; background:#fafbfd; }
.anomaly-overview-category-head,
.anomaly-overview-rule { display:flex; align-items:center; justify-content:space-between; gap:8px; width:100%; height:auto; text-align:left; border:1px solid transparent; background:transparent; box-shadow:none; padding:7px 5px; }
.anomaly-overview-category-head { font-size:13px; font-weight:600; margin-bottom:4px; }
.anomaly-overview-category-head b { color:var(--blue); white-space:nowrap; }
.anomaly-overview-category-head small { font-size:11px; font-weight:400; }
.anomaly-overview-rule { font-size:12px; font-weight:400; }
.anomaly-overview-rule>span:first-child { min-width:0; overflow-wrap:anywhere; color:var(--muted); }
.anomaly-overview-rule b,
.anomaly-overview-rule>span:last-child { flex-shrink:0; font-variant-numeric:tabular-nums; }
.anomaly-overview-category button:not(:disabled):hover,
.anomaly-overview-category button[aria-pressed=true] { background:#edf3ff; border-color:#c4d5f5; }
.anomaly-overview-category button:disabled { opacity:1; cursor:default; }
.anomaly-overview-note { margin:12px 20px 16px; overflow-wrap:anywhere; }
.anomaly-disclosure>summary { display:flex; align-items:center; gap:12px; padding:14px 20px; cursor:pointer; list-style:none; }
.anomaly-disclosure>summary::-webkit-details-marker { display:none; }
.anomaly-disclosure>summary:before { content:'›'; font-size:20px; line-height:1; color:var(--muted); transition:transform .15s; }
.anomaly-disclosure[open]>summary:before { transform:rotate(90deg); }
.anomaly-disclosure[open]>summary { border-bottom:1px solid var(--line); }
.anomaly-disclosure>summary h2 { font-size:14px; font-weight:600; margin:0; }
.anomaly-disclosure-hint { margin-left:auto; white-space:nowrap; color:var(--muted); font-size:11px; }
.anomaly-disclosure-hint:after { content:'展开'; }
.anomaly-disclosure[open]>summary .anomaly-disclosure-hint:after { content:'收起'; }
.anomaly-scan-state { color:var(--blue); font-size:12px; white-space:nowrap; }
.anomaly-scan-summary { color:var(--muted); font-size:12px; }
.anomaly-scan-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.anomaly-batch-form label { font-size:12px; }
.anomaly-batch-form input { width:90px; }
.anomaly-coverage-panel { margin-top:16px; }
.anomaly-coverage-panel summary { cursor:pointer; color:var(--muted); font-size:12px; }
.anomaly-coverage { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin:12px 0; }
.anomaly-rule-status { padding:12px 14px; background:var(--bg,#f6f8fb); border-radius:8px; min-width:0; border:1px solid var(--line); }
.anomaly-rule-status b,
.anomaly-rule-status span,
.anomaly-rule-status small { display:block; font-size:12px; overflow-wrap:anywhere; }
.anomaly-rule-status b { font-size:13px; margin-bottom:6px; }
.anomaly-rule-status span,
.anomaly-rule-status small { color:var(--muted); margin-top:4px; }
.anomaly-rule-status.incomplete { border-color:#eab968; background:#fff8ea; }
.anomaly-progress { margin:16px 0; }
.anomaly-progress-head { display:flex; align-items:center; justify-content:space-between; gap:12px; font-size:13px; margin-bottom:8px; }
.anomaly-progress-head b { color:var(--blue); font-variant-numeric:tabular-nums; }
.anomaly-progress-bar { display:block; width:100%; height:10px; border:0; border-radius:999px; overflow:hidden; appearance:none; background:var(--line); color:var(--blue); }
.anomaly-progress-bar::-webkit-progress-bar { background:var(--line); border-radius:999px; }
.anomaly-progress-bar::-webkit-progress-value { background:var(--blue); border-radius:999px; }
.anomaly-progress-bar::-moz-progress-bar { background:var(--blue); border-radius:999px; }
.anomaly-progress p { margin:8px 0 0; overflow-wrap:anywhere; }
.anomaly-query-panel>summary { border-bottom:1px solid var(--line); font-size:13px; }
.anomaly-query-summary { color:var(--muted); font-size:12px; min-width:0; overflow-wrap:anywhere; }
.anomaly-filters { padding:18px 20px; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; border-bottom:1px solid var(--line); }
.anomaly-filters label { display:flex; flex-direction:column; gap:6px; font-size:12px; color:var(--muted); min-width:0; }
.anomaly-filters input,
.anomaly-filters select { width:100%; min-width:0; }
.anomaly-filter-actions { align-self:end; flex-wrap:wrap; }
.anomaly-list { scroll-margin-top:20px; }
.anomaly-list .card-head { flex-wrap:wrap; gap:8px; }
.anomaly-table { min-width:1050px; width:100%; }
.anomaly-table td { vertical-align:middle; }
.anomaly-table td small { display:block; color:var(--muted); font-size:11px; margin-top:5px; }
.anomaly-table td:first-child { min-width:220px; }
.anomaly-table tbody tr { cursor:pointer; }
.anomaly-table tbody tr:hover,
.anomaly-table tbody tr:focus-visible { background:#edf3ff; }
.anomaly-table tbody tr:focus-visible { outline:2px solid var(--blue); outline-offset:-2px; }
.anomaly-pagination { padding:16px 20px; display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.anomaly-pagination label { display:flex; gap:8px; align-items:center; font-size:12px; white-space:nowrap; }
.anomaly-pagination select { width:70px; }
.anomaly-error,
.anomaly-note-error { color:var(--red,#b42318); overflow-wrap:anywhere; }
/* Keep evidence, account navigation and confirmation visible without scrolling the whole dialog. */
dialog.anomaly-dialog { width:min(1280px,calc(100vw - 32px)); max-width:1280px; }
dialog.anomaly-dialog[open] { display:flex; flex-direction:column; height:min(800px,calc(100dvh - 32px)); max-height:calc(100dvh - 32px); overflow:hidden; }
.anomaly-dialog .dialog-head,
.anomaly-dialog .dialog-foot { flex-shrink:0; }
.anomaly-dialog .dialog-body { display:flex; flex:1; min-height:0; max-height:none; overflow:hidden; padding:0; }
.anomaly-detail { display:flex; flex-direction:column; min-width:0; min-height:0; width:100%; }
.anomaly-detail-summary { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; padding:16px 20px; border-bottom:1px solid var(--line); }
.anomaly-detail-summary>b { overflow-wrap:anywhere; min-width:0; }
.anomaly-detail-summary .badge { flex-shrink:0; }
.anomaly-detail-columns { display:grid; grid-template-columns:minmax(0,0.85fr) minmax(0,1.15fr); flex:1; min-height:0; }
.anomaly-evidence-panel { overflow:auto; padding:18px 20px; min-width:0; }
.anomaly-detail h3 { font-size:14px; margin:0 0 12px; }
.anomaly-rule-description { color:var(--muted); font-size:12px; line-height:1.7; margin:0 0 12px; overflow-wrap:anywhere; }
.anomaly-evidence { margin:0 0 18px; padding-left:20px; font-size:13px; line-height:1.8; overflow-wrap:anywhere; white-space:pre-wrap; }
.anomaly-evidence li { margin-bottom:6px; }
.anomaly-detail-facts { margin:0; padding-top:12px; border-top:1px solid var(--line); font-size:12px; }
.anomaly-detail-facts>div { display:grid; grid-template-columns:96px minmax(0,1fr); gap:8px; margin:8px 0; }
.anomaly-detail-facts dt { color:var(--muted); }
.anomaly-detail-facts dd { margin:0; overflow-wrap:anywhere; }
.anomaly-related-panel { border-left:1px solid var(--line); padding:12px 16px; display:flex; flex-direction:column; min-width:0; min-height:0; }
.anomaly-detail-tabs { display:flex; flex-shrink:0; gap:8px; padding-bottom:12px; }
.anomaly-detail-tabs button { font-size:12px; }
.anomaly-detail-tabs button[aria-pressed=true] { color:var(--blue); background:#edf3ff; border-color:#c4d5f5; }
.anomaly-related-content { display:flex; flex-direction:column; flex:1; min-height:0; }
.anomaly-accounts,
.anomaly-history { min-height:0; flex:1; overflow:auto; }
.anomaly-accounts table { width:100%; min-width:420px; }
.anomaly-accounts td,
.anomaly-accounts th { padding:10px 8px; font-size:12px; }
.anomaly-accounts small { display:block; font-size:11px; color:var(--muted); margin-top:4px; }
.anomaly-accounts a { white-space:nowrap; }
.anomaly-target-list { flex:1; min-height:0; overflow:auto; }
.anomaly-target { padding:8px 0; border-bottom:1px solid var(--line); font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.anomaly-target p { margin:4px 0; }
.anomaly-target-heading { display:flex; flex-wrap:wrap; gap:4px 8px; align-items:center; }
.anomaly-target-links { margin-left:auto; flex-shrink:0; white-space:nowrap; }
.anomaly-product-name { flex:1; min-width:0; font-size:13px; white-space:normal; }
.anomaly-target-line { display:flex; flex-wrap:wrap; gap:4px 8px; align-items:center; margin-top:4px; }
.anomaly-target-line>span { min-width:0; }
.anomaly-target-line>button,
.anomaly-target-actions { margin-left:auto; }
.anomaly-target-actions { display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px; }
.anomaly-target button { flex-shrink:0; padding:4px 8px; font-size:11px; }
.anomaly-target-meta { display:flex; flex-wrap:wrap; gap:2px 10px; color:var(--muted); font-size:11px; }
.anomaly-target-meta>span { min-width:0; }
.anomaly-order-id { user-select:all; }
.anomaly-device-row { display:flex; gap:8px; align-items:center; justify-content:space-between; padding:3px 0; }
.anomaly-device-row>span { min-width:0; overflow-wrap:anywhere; user-select:all; }
.anomaly-device-row>button { flex-shrink:0; }
.anomaly-action-context .row { align-items:flex-start; }
.anomaly-action-context input[type=checkbox] { width:auto; flex-shrink:0; }
.anomaly-history { overflow-wrap:anywhere; }
.anomaly-history>div { padding:8px 0; border-bottom:1px solid var(--line); }
.anomaly-history small { color:var(--muted); font-size:11px; }
.anomaly-history p { margin:4px 0; font-size:12px; white-space:pre-wrap; }
.anomaly-detail-pagination { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; gap:8px; padding-top:12px; font-size:12px; color:var(--muted); }
.anomaly-detail-pagination button { padding:6px 9px; font-size:12px; }
.anomaly-dialog .dialog-foot { display:block; padding:12px 20px; }
.anomaly-note-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 16px; align-items:end; }
.anomaly-note-field { display:flex; flex-direction:column; gap:5px; color:var(--muted); font-size:12px; min-width:0; }
.anomaly-note-form textarea { width:100%; min-width:0; box-sizing:border-box; resize:none; height:38px; }
.anomaly-note-actions { display:flex; gap:8px; }
.anomaly-note-form p,
.anomaly-note-error { grid-column:1/-1; margin:0; font-size:12px; }
.anomaly-note-error:empty { display:none; }
@media(max-width:1100px) {
  .anomaly-overview-categories,
  .anomaly-coverage { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .anomaly-filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:760px) {
  .anomaly-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .anomaly-metrics .metric { padding:10px 14px; }
  .anomaly-metrics .metric:nth-child(2) { border-right:0; }
  .anomaly-metrics .metric b { font-size:26px; }
  .anomaly-overview-categories { padding:0 14px; gap:10px; }
  .anomaly-overview-note { margin-left:14px; margin-right:14px; }
  .anomaly-filters { grid-template-columns:repeat(2,minmax(0,1fr)); padding:14px; gap:12px; }
  .anomaly-disclosure>summary { padding:12px 14px; gap:8px; flex-wrap:wrap; }
  .anomaly-query-summary,
  .anomaly-scan-summary { flex-basis:100%; order:1; }
  .anomaly-overview .card-head { flex-wrap:wrap; gap:8px; }
  .anomaly-overview .card-head h2 small { display:block; margin-left:0; }
  .anomaly-pagination>.row { flex-wrap:wrap; }
  .anomaly-table-wrap { overflow-x:auto; }
  dialog.anomaly-dialog { width:calc(100vw - 16px); }
  dialog.anomaly-dialog[open] { height:calc(100dvh - 16px); max-height:calc(100dvh - 16px); }
  .anomaly-detail-summary { padding:12px; flex-wrap:wrap; gap:6px; }
  .anomaly-detail-columns { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(100px,0.8fr) minmax(140px,1.2fr); }
  .anomaly-evidence-panel { padding:12px; }
  .anomaly-related-panel { border-left:0; border-top:1px solid var(--line); padding:10px 12px; }
  .anomaly-dialog .dialog-foot { padding:10px 12px; }
  .anomaly-accounts table { min-width:0; table-layout:fixed; }
  .anomaly-accounts td { overflow-wrap:anywhere; }
  .anomaly-accounts th:first-child { width:28%; }
  .anomaly-accounts th:nth-child(2) { width:48%; }
  .anomaly-accounts th:last-child { width:24%; }
  .anomaly-note-form { grid-template-columns:minmax(0,1fr); }
  .anomaly-note-actions { justify-content:flex-end; }
  .anomaly-detail-pagination { flex-wrap:wrap; }
}
@media(max-width:380px) {
  .anomaly-overview-categories,
  .anomaly-coverage { grid-template-columns:1fr; }
  .anomaly-filter-actions { grid-column:1/-1; }
}
