:root {
  --bg: #060a12;
  --bg-soft: #0a111d;
  --panel: #0d1626;
  --panel-2: #111d31;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #e7eefb;
  --muted: #8b9cb6;
  --cyan: #38bdf8;
  --cyan-soft: rgba(56, 189, 248, 0.14);
  --violet: #a78bfa;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(900px 600px at 90% 0%, rgba(167, 139, 250, 0.10), transparent 55%),
    var(--bg);
  font-family: "Inter", "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- scrollbars ---------- */
/* Chromium / Safari：细滚动条 + 圆角滑块，滑块本体用 border + background-clip 收窄 */
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.32);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.55);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
  background: rgba(56, 189, 248, 0.75);
  background-clip: padding-box;
}

/* 面板内滚动区：略细一点，带一条很淡的轨道，鼠标进入面板时滑块变亮 */
.table-wrap::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.chart-scroll::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.table-wrap::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.05);
  border-radius: 999px;
  margin: 4px;
}

.table-wrap::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.chart-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.table-wrap:hover::-webkit-scrollbar-thumb,
.modal-body:hover::-webkit-scrollbar-thumb,
.chart-scroll:hover::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.45);
  background-clip: padding-box;
}

/* 滚动不带动整页 */
.table-wrap,
.modal-body,
.chart-scroll {
  overscroll-behavior: contain;
}

/* Firefox：没有 ::-webkit-scrollbar，走标准属性 */
@supports not selector(::-webkit-scrollbar) {
  html,
  .table-wrap,
  .modal-body,
  .chart-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.38) transparent;
  }
}

code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
  color: #9fd8ff;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: none;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.brand-logo {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #041018;
  background: linear-gradient(135deg, #67e8f9, #38bdf8 45%, #818cf8);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.28);
}

.brand-logo svg { width: 24px; height: 24px; }

.brand h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: 0.01em; }

.brand-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions { display: flex; align-items: center; gap: 12px; flex: none; }

/* ---------- global date picker ---------- */
.global-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.75);
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.global-date:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.global-date.filtered {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.09);
}

.global-date.filtered svg { color: var(--cyan); }

.global-date svg { width: 15px; height: 15px; flex: none; }

.global-date select {
  appearance: none;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%238b9cb6' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right center;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 15px 0 0;
  max-width: 128px;
  cursor: pointer;
}

.global-date select option { background: #0d1626; color: var(--text); }

/* ---------- top navigation ---------- */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  background: rgba(10, 17, 29, 0.72);
  border-radius: 11px;
  flex: none;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  padding: 7px 18px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 520;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}

.topnav a:hover { color: var(--text); background: rgba(148, 163, 184, 0.09); }

.topnav a.active {
  color: #d9f2ff;
  background: rgba(56, 189, 248, 0.14);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0.05); }
}

.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- layout ---------- */
.wrap {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 24px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.view { display: flex; flex-direction: column; gap: 20px; }
.view[hidden] { display: none; }

.panel {
  background: linear-gradient(180deg, rgba(17, 29, 49, 0.9), rgba(10, 17, 29, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.hint { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }

.panel-actions { display: flex; align-items: center; gap: 10px; }

.legend { color: var(--muted); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.dot.cyan { background: linear-gradient(180deg, #7dd3fc, #0ea5e9); }

/* ---------- stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(22, 35, 58, 0.95), rgba(11, 18, 31, 0.95));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 15px;
  min-height: 96px;
  box-shadow: var(--shadow);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent, var(--cyan));
  opacity: 0.9;
}

.stat-label {
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat-label .mini-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent, var(--cyan));
  box-shadow: 0 0 10px var(--accent, var(--cyan));
}

.stat-value {
  margin-top: 8px;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-sub { margin-top: 2px; color: var(--muted); font-size: 12px; }

.stat-card.clickable { cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; }
.stat-card.clickable:hover { transform: translateY(-2px); border-color: var(--line-strong); }

.skeleton {
  min-height: 96px;
  background: linear-gradient(100deg, rgba(30, 44, 70, 0.45) 30%, rgba(48, 68, 105, 0.55) 50%, rgba(30, 44, 70, 0.45) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- chart ---------- */
.chart-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
.chart { min-width: 100%; }
.chart svg { display: block; }

.chart .bar { cursor: pointer; transition: opacity 0.12s ease; }
.chart .bar:hover { opacity: 0.82; }
.chart text { fill: var(--muted); font-size: 10.5px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 5; }

/* ---------- two column ---------- */
.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
}

/* ---------- toolbar / inputs ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar .select { width: 148px; flex: none; }

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(7, 12, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.search-box svg { width: 15px; height: 15px; color: var(--muted); flex: none; }

.search-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  padding: 9px 0;
}

.search-box input::placeholder, .input::placeholder { color: #64748b; }

.input, .select {
  background: rgba(7, 12, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  padding: 9px 11px;
  outline: 0;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus, .select:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9cb6' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select option { background: #0d1626; color: var(--text); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.10));
  color: #d7f2ff;
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover { background: linear-gradient(180deg, rgba(56, 189, 248, 0.32), rgba(56, 189, 248, 0.16)); border-color: rgba(56, 189, 248, 0.6); }
.btn:active { transform: translateY(1px); }

.btn svg { width: 15px; height: 15px; }

.btn.ghost {
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--line);
  color: var(--muted);
}

.btn.ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(148, 163, 184, 0.12); }

.btn.danger {
  border-color: rgba(248, 113, 113, 0.42);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.24), rgba(248, 113, 113, 0.12));
  color: #fecaca;
}

.btn.danger:hover {
  border-color: rgba(248, 113, 113, 0.7);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.34), rgba(248, 113, 113, 0.18));
}

.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* 「暂停分析」在分析进行中才可点，用琥珀色与删除类红色区分 */
.btn.ghost.armed {
  border-color: rgba(251, 191, 36, 0.42);
  background: rgba(251, 191, 36, 0.10);
  color: #fcd34d;
}

.btn.ghost.armed:hover:not(:disabled) {
  border-color: rgba(251, 191, 36, 0.68);
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

/* 分析中的「开始分析」保持正常外观，只换成等待光标 */
.btn.loading:disabled {
  opacity: 0.9;
  cursor: progress;
}

.btn.tiny { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.tiny.ghost { cursor: default; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover { color: var(--text); background: rgba(148, 163, 184, 0.12); }

/* ---------- tables ---------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.35);
}

.logs-table-wrap { max-height: 620px; }

#logsPanel .table-wrap { max-height: 640px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 540;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #0f1a2c;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.1s ease; }
.data-table tbody tr:hover { background: rgba(56, 189, 248, 0.045); }

.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.col-rank { width: 46px; }
.col-time { width: 158px; white-space: nowrap; }
.col-method { width: 72px; }
.col-status { width: 72px; }

.empty-cell { text-align: center !important; color: var(--muted); padding: 28px 12px !important; }

.ip-cell { display: inline-flex; align-items: center; gap: 8px; }

.ip-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: #7dd3fc;
  font: inherit;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  cursor: pointer;
}
.ip-btn:hover { text-decoration: underline; }

.ip-copy {
  flex: 0 0 auto;
  align-self: center;
  height: 18px;
  border: 1px solid rgba(125, 211, 252, 0.32);
  background: rgba(125, 211, 252, 0.08);
  color: #7dd3fc;
  font: inherit;
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  padding: 0 5px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease, background 0.15s ease,
    color 0.15s ease, border-color 0.15s ease;
}
.ip-cell:hover .ip-copy,
.ip-cell:focus-within .ip-copy { opacity: 1; visibility: visible; }
.ip-copy:hover { background: rgba(125, 211, 252, 0.22); }
.ip-copy:active { transform: translateY(1px); }
.ip-copy.copied {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.5);
  background: rgba(134, 239, 172, 0.12);
}

.rank-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-num.top1 { color: #fbbf24; }
.rank-num.top2 { color: #cbd5e1; }
.rank-num.top3 { color: #f59e0b; }

.path-cell {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  color: #c7d6ea;
}
.path-cell:hover { color: var(--cyan); }
.path-cell .q { color: var(--muted); font-size: 12px; }

.ua-cell {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.referer-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.size-cell { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.time-cell { color: #b9c8dd; font-variant-numeric: tabular-nums; font-size: 12.5px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.badge.s2 { color: #6ee7b7; background: rgba(52, 211, 153, 0.14); }
.badge.s3 { color: #93c5fd; background: rgba(96, 165, 250, 0.14); }
.badge.s4 { color: #fcd34d; background: rgba(251, 191, 36, 0.14); }
.badge.s5 { color: #fca5a5; background: rgba(248, 113, 113, 0.14); }
.badge.s0 { color: #cbd5e1; background: rgba(148, 163, 184, 0.14); }

.method-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.03em;
  color: #a5b4fc;
  background: rgba(129, 140, 248, 0.13);
}

/* ---------- filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 12px;
}

.filters .search-box.wide { flex: 1 1 300px; }
.filters .input { width: 170px; flex: 0 1 170px; }
.filters .select { width: 128px; flex: 0 1 128px; }

.date-field {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(7, 12, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 8px 0 10px;
  height: 38px;
}

.date-field input {
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: 0;
  width: 150px;
  color-scheme: dark;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--cyan-soft);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #bfe9ff;
  font-size: 12px;
  max-width: 100%;
}

.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button {
  width: 17px; height: 17px;
  border: 0; border-radius: 50%;
  background: rgba(56, 189, 248, 0.18);
  color: #bfe9ff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.chip button:hover { background: rgba(56, 189, 248, 0.4); }

.chip.type-path { background: rgba(167, 139, 250, 0.13); border-color: rgba(167, 139, 250, 0.28); color: #ddd0ff; }
.chip.type-path button { background: rgba(167, 139, 250, 0.2); color: #ddd0ff; }
.chip.type-time { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.24); color: #b8f3dc; }
.chip.type-time button { background: rgba(52, 211, 153, 0.2); color: #b8f3dc; }

/* ---------- pager ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.page-info { margin-right: auto; }

.page-btn {
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.06);
  color: #c3d2e6;
  border-radius: 8px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.page-btn:hover:not(:disabled) { border-color: var(--line-strong); background: rgba(148, 163, 184, 0.13); }
.page-btn:disabled { opacity: 0.38; cursor: default; }

.page-jump {
  width: 58px;
  background: rgba(7, 12, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 8px;
  outline: 0;
  text-align: center;
}

.page-jump:focus { border-color: rgba(56, 189, 248, 0.5); }

/* ---------- footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: #5f7089;
  font-size: 12px;
  padding: 4px 2px 0;
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 14, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(860px, 100%);
  max-height: min(86vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #101c2f, #0a1321);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: pop 0.16s ease-out;
}

@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 { margin: 0; font-size: 15px; font-weight: 620; }
.modal-head-actions { display: flex; align-items: center; gap: 8px; }

.modal-body { padding: 18px; overflow: auto; }

.detail-grid {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 9px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; word-break: break-all; color: #dbe7f7; }
.detail-grid dd.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; color: #a5e0ff; }

.raw-block {
  background: #060b14;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.65;
  color: #a9c2dd;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ---------- 日志详情：单条记录 AI 分析 ---------- */
.detail-ai {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.detail-ai[hidden] { display: none; }

.ai-record-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-record-head .risk-meter { flex: 0 1 150px; min-width: 90px; }

.ai-record-verdict { font-size: 15px; font-weight: 600; }
.ai-record-verdict.high { color: #fca5a5; }
.ai-record-verdict.medium { color: #fcd34d; }
.ai-record-verdict.low { color: #6ee7b7; }

.ai-record-summary {
  margin: 11px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.06);
  color: #dbe7f7;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

.ai-record-title {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ai-record-reasons {
  margin: 0;
  padding-left: 18px;
  color: #dbe7f7;
  font-size: 13px;
}

.ai-record-reasons li { margin: 3px 0; word-break: break-all; }

.ai-record-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 18px;
  font-size: 12.5px;
}

.ai-record-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
}

.ai-record-facts span { color: var(--muted); white-space: nowrap; }
.ai-record-facts b { font-weight: 500; color: #dbe7f7; text-align: right; word-break: break-all; }

.ai-record-note { margin: 11px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.ai-record-note.error { color: #fca5a5; }

.ai-record-loading {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  color: var(--muted);
  font-size: 13px;
}

.ai-record-loading .dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--cyan);
  animation: ai-record-pulse 1s ease-in-out infinite;
}

@keyframes ai-record-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.ai-record-error {
  padding: 10px 12px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font-size: 13px;
}

#detailAi.busy { opacity: 0.7; cursor: progress; }

@media (max-width: 640px) {
  .ai-record-facts { grid-template-columns: 1fr; }
  .ai-record-head .risk-meter { flex: 1 1 auto; }
}


/* ---------- update modal ---------- */
.update-card { width: min(580px, 100%); }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.update-body { padding: 16px 18px 18px; }

.update-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.45);
  margin-bottom: 16px;
}

.update-tab {
  flex: 1;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.update-tab:hover { color: var(--text); }

.update-tab.active {
  background: rgba(56, 189, 248, 0.16);
  color: #d7f2ff;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.32);
}

.update-pane { margin-bottom: 4px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.field[hidden] { display: none; }

.field > span,
.field-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.field-label { cursor: pointer; }

.field > input {
  width: 100%;
  background: rgba(7, 12, 22, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  outline: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field > input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.field > input::placeholder { color: #64748b; }

.update-date { max-width: 220px; }

.required-mark {
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  border-radius: 4px;
  font-style: normal;
  font-size: 11px;
  line-height: 16px;
  color: var(--red);
}

.update-date input[aria-invalid="true"] {
  border-color: rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

.update-date-hint { margin: -4px 0 14px; }

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 26px 16px;
  border: 1.5px dashed rgba(148, 163, 184, 0.32);
  border-radius: 12px;
  background: rgba(6, 11, 20, 0.35);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin-bottom: 12px;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.07);
  color: var(--text);
}

.drop-zone.has-file {
  border-style: solid;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.06);
  color: #d2f7e9;
}

.drop-zone input { display: none; }
.drop-zone svg { width: 26px; height: 26px; color: var(--cyan); }
.drop-zone span { font-size: 13px; word-break: break-all; }
.drop-zone em { font-style: normal; font-size: 11.5px; color: #5f7089; }

.update-progress { margin: 4px 0 12px; }

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  transition: width 0.3s ease;
}

.progress-fill.indeterminate {
  width: 35%;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}

.progress-meta .error { color: #fca5a5; }

.update-result {
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.07);
  border-radius: 11px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #d2f7e9;
  word-break: break-all;
}

.update-result b { color: #a7f3d0; font-weight: 600; }
.update-result.error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
  color: #ffd6d6;
}

/* ---------- AI risk analysis ---------- */
.engine-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.10);
  color: #d8ccff;
  font-size: 12px;
  white-space: nowrap;
}

.engine-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 8px var(--violet);
}

.engine-pill.local {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.09);
  color: #cdeeff;
}

.engine-pill.local::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.ai-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px;
}

.ai-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 132px;
}

.ai-field > span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.ai-field .input,
.ai-field .select {
  height: 38px;
  min-width: 132px;
}

.ai-field.static { min-width: 110px; }

.ai-switch-field { flex: 0 0 auto; min-width: 128px; }

.switch-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
}

.switch-state {
  font-style: normal;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
  color: var(--muted);
  min-width: 40px;
  transition: color 0.2s ease;
}

.switch-state.on { color: #7dd3fc; }
.switch-state.off { color: var(--muted); }

/* 通用开关：AI 大模型复核 / 定时任务弹窗共用 */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 24px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.38);
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.switch-track > i,
.switch-track > .switch-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #93a4bb;
  box-shadow: 0 1px 3px rgba(2, 8, 20, 0.45);
  transition: transform 0.26s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.22s ease,
    box-shadow 0.22s ease;
}

.switch input:checked + .switch-track {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  border-color: rgba(125, 211, 252, 0.72);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.28), 0 3px 12px rgba(56, 189, 248, 0.32);
}

.switch input:checked + .switch-track > i,
.switch input:checked + .switch-track > .switch-dot {
  transform: translateX(20px);
  background: #f8fbff;
  box-shadow: 0 1px 4px rgba(2, 8, 20, 0.45);
}

.switch:hover .switch-track {
  border-color: rgba(148, 163, 184, 0.46);
}

.switch:hover input:checked + .switch-track {
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3), 0 4px 16px rgba(56, 189, 248, 0.48);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 3px;
}

.switch input:disabled + .switch-track {
  opacity: 0.42;
  box-shadow: none;
}

.switch:has(input:disabled) { cursor: not-allowed; }

.ai-field.static strong {
  height: 38px;
  display: flex;
  align-items: center;
  color: #cfe6ff;
  font-weight: 560;
  font-size: 13.5px;
}

.ai-controls .btn { height: 38px; }

.ai-note { margin: 12px 0 0; }

.ai-progress { margin-top: 14px; }
.ai-progress .hint { margin-top: 8px; }

.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-size: 12.5px;
}

.progress-phase {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #cfe6ff;
  font-weight: 560;
  letter-spacing: 0.01em;
}

.progress-phase::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.progress-pct {
  color: var(--muted);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
}

.ai-error { margin-top: 14px; }

.ai-summary { margin: 0; }

.ai-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 46px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(10, 17, 29, 0.45);
  text-align: center;
}

.ai-empty[hidden] { display: none; }
.ai-empty h3 { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.ai-empty p { margin: 0; max-width: 460px; color: var(--muted); font-size: 13px; }

.ai-empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #b9a8ff;
  background: rgba(167, 139, 250, 0.10);
  border: 1px solid rgba(167, 139, 250, 0.24);
}

.ai-empty-icon svg { width: 26px; height: 26px; }

.seg {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 12, 22, 0.6);
}

.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.seg button:hover { color: var(--text); }

.seg button.active {
  color: #d9f2ff;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28);
}

.ai-table-wrap { max-height: 720px; }

.ai-table td { vertical-align: middle; }
.ai-table .col-risk { width: 118px; }
.ai-table .col-client { width: 136px; }
.ai-table .col-ai-review { width: 92px; }
.ai-table .col-ai-action { width: 96px; text-align: right; }

.client-col { white-space: nowrap; }

.client-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

.client-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}

.client-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.client-badge.human {
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.client-badge.crawler {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.32);
}

.client-badge.machine {
  color: #a5b4fc;
  background: rgba(129, 140, 248, 0.14);
  border-color: rgba(129, 140, 248, 0.34);
}

.client-detail {
  display: block;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}

.ai-review-cell { white-space: nowrap; }

.ai-review {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.5;
}

.ai-review.llm {
  color: #86efac;
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.32);
}

.ai-review.none {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.10);
  border-color: rgba(148, 163, 184, 0.22);
}

.ai-review.running {
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.34);
  animation: ai-review-pulse 1.6s ease-in-out infinite;
}

@keyframes ai-review-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.risk-cell { display: flex; align-items: center; gap: 9px; }

.risk-score {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 27px;
}

.risk-score.high { color: #fca5a5; }
.risk-score.medium { color: #fcd34d; }
.risk-score.low { color: #6ee7b7; }

.risk-meter {
  flex: 1;
  height: 5px;
  min-width: 42px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.risk-meter i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #34d399);
}

.risk-meter.high i { background: linear-gradient(90deg, #fbbf24, #f87171); }
.risk-meter.medium i { background: linear-gradient(90deg, #38bdf8, #fbbf24); }
.risk-meter.low i { background: linear-gradient(90deg, #34d399, #67e8f9); }

.risk-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.risk-badge.high { color: #fca5a5; background: rgba(248, 113, 113, 0.14); }
.risk-badge.medium { color: #fcd34d; background: rgba(251, 191, 36, 0.14); }
.risk-badge.low { color: #6ee7b7; background: rgba(52, 211, 153, 0.14); }

.geo-cell {
  max-width: 250px;
  white-space: normal;
  color: #c3d3e8;
  font-size: 12.5px;
  line-height: 1.45;
}

.geo-cell .geo-isp { color: var(--muted); font-size: 11.5px; }

.verdict-cell { min-width: 150px; max-width: 240px; white-space: normal; }
.verdict-cell b { font-weight: 600; font-size: 12.8px; }
.verdict-cell.high b { color: #fca5a5; }
.verdict-cell.medium b { color: #fcd34d; }
.verdict-cell.low b { color: #9ae6c8; }
.verdict-cell span { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.45; }

.ai-detail-row td {
  padding: 0 !important;
  background: rgba(5, 9, 17, 0.5);
}

.ai-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 15px 18px 17px;
}

.ai-detail-block h4 {
  margin: 0 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.ai-detail-block ul { margin: 0; padding-left: 17px; color: #c7d6ea; font-size: 12.5px; line-height: 1.7; }
.ai-detail-block li { word-break: break-all; }
.ai-detail-block .mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 11.8px; color: #a9c4e0; }

.ai-tag {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 5px 5px 0;
  border-radius: 5px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--line);
  color: #c3d3e8;
  font-size: 11.5px;
  word-break: break-all;
}

.ai-meta { color: var(--muted); font-size: 12px; }
.ai-row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.ai-link {
  border: 0;
  background: transparent;
  color: #7dd3fc;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
  white-space: nowrap;
}
.ai-link:hover { background: rgba(56, 189, 248, 0.12); text-decoration: underline; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  z-index: 200;
  background: #13253c;
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #d9f2ff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.toast[hidden] { display: none; }
.toast.error { border-color: rgba(248, 113, 113, 0.5); color: #ffd6d6; }

/* ---------- 定时任务 ---------- */
.schedule-btn { position: relative; }

.schedule-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.16);
}

.schedule-dot[hidden] { display: none; }
.schedule-dot.running {
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.18);
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot { 50% { opacity: 0.35; } }

.schedule-card { width: min(600px, 100%); }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6, 11, 20, 0.38);
}

.switch-text { min-width: 0; }
.switch-text strong { font-size: 13.5px; font-weight: 600; }
.switch-text .hint { margin: 3px 0 0; }

.schedule-time-row { display: flex; gap: 14px; align-items: flex-start; }
.schedule-time-row .field { flex: 1 1 160px; margin-bottom: 14px; }
.schedule-time-row .field:first-child { flex: 1 1 260px; }

.schedule-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.42);
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.mode-btn strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.mode-btn span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.mode-btn:hover { border-color: rgba(148, 163, 184, 0.45); }

.mode-btn.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.20);
}

.mode-btn.active strong { color: #d7f2ff; }

.mode-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.65);
  outline-offset: 1px;
}

.interval-inputs { display: flex; align-items: center; gap: 7px; }
.interval-inputs em { font-style: normal; font-size: 12.5px; color: var(--muted); }

.interval-inputs input {
  width: 66px;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.interval-inputs input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.field.static strong {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 11px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(7, 12, 22, 0.45);
  font-size: 13px;
  font-weight: 500;
  color: #a5e0ff;
}

.schedule-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 2px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line);
}

.schedule-status > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 13px;
  background: #0a1321;
}

.schedule-status > div.full { grid-column: 1 / -1; }
.schedule-status span { font-size: 11.5px; color: var(--muted); }

.schedule-status strong {
  font-size: 12.8px;
  font-weight: 500;
  color: #dbe7f7;
  word-break: break-all;
}

.schedule-status strong.done { color: #7ee7bb; }
.schedule-status strong.error { color: #fca5a5; }
.schedule-status strong.running { color: var(--amber); }

.schedule-note { margin: -2px 0 12px; }

#aiClearHistory { cursor: pointer; }
.ai-empty-note { margin-top: 6px !important; font-size: 12px; color: #66788f; }

/* ---------- 数据管理（按日期删除日志） ---------- */
.manage-card { width: min(620px, 100%); }

.manage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.45);
  font-size: 13px;
}

.manage-metric { display: inline-flex; align-items: baseline; gap: 6px; }
.manage-metric em { font-style: normal; color: var(--muted); font-size: 12px; }
.manage-metric strong { font-weight: 600; color: var(--text); }

.manage-bulk {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 12.5px;
}

.manage-bulk input {
  width: 64px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(6, 11, 20, 0.6);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: center;
}

.manage-bulk .btn.tiny.ghost { cursor: pointer; }

.manage-days {
  max-height: 320px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.35);
  margin-bottom: 14px;
}

.manage-day {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  cursor: pointer;
  transition: background 0.12s ease;
}

.manage-day:last-child { border-bottom: 0; }
.manage-day:hover { background: rgba(56, 189, 248, 0.06); }
.manage-day.checked { background: rgba(248, 113, 113, 0.08); }

.manage-day input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #f87171;
  cursor: pointer;
  flex: 0 0 auto;
}

.manage-day-name {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  color: #dbe7f7;
}

.manage-today {
  font-style: normal;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.18);
  color: #9cdcfe;
}

.manage-day-hits { flex: 1 1 auto; text-align: right; color: var(--text); }
.manage-day-bytes { flex: 0 0 82px; text-align: right; color: var(--muted); }
.manage-day-share { flex: 0 0 68px; text-align: right; color: #6f8299; font-size: 12px; }
.manage-day .btn.tiny.ghost { cursor: pointer; flex: 0 0 auto; }

.manage-day .btn.tiny.ghost:hover {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.12);
}

.manage-empty {
  padding: 22px 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.manage-vacuum {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(6, 11, 20, 0.4);
  font-size: 13px;
  cursor: pointer;
}

.manage-vacuum input { margin-top: 2px; width: 15px; height: 15px; accent-color: #38bdf8; flex: 0 0 auto; }
.manage-vacuum em { display: block; font-style: normal; color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.6; }

.manage-confirm {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 11px;
  background: rgba(248, 113, 113, 0.08);
}

.manage-warn { margin: 0 0 10px; font-size: 13px; line-height: 1.65; color: #fecaca; }
.manage-warn strong { color: #fff; }
.manage-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 520px) {
  .manage-day-bytes, .manage-day-share { display: none; }
  .manage-day { gap: 8px; padding: 9px 10px; }
}

/* ---------- access gate ---------- */
body.auth-locked { overflow: hidden; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(10px);
}
.auth-gate[hidden] { display: none; }

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 28px 26px 22px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(17, 29, 49, 0.97), rgba(13, 22, 38, 0.97));
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.auth-logo svg { width: 22px; height: 22px; }

.auth-card h2 { margin: 0 0 6px; font-size: 17px; letter-spacing: 0.2px; }
.auth-card .hint { margin: 0 0 18px; }

.auth-field { position: relative; display: block; }
.auth-field > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.auth-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(6, 11, 20, 0.75);
  color: var(--text);
  font: inherit;
  letter-spacing: 0.08em;
}
.auth-field input::placeholder { letter-spacing: normal; color: #64748b; }
.auth-field input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.auth-error {
  margin: 10px 0 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  font-size: 12.5px;
  text-align: left;
}
.auth-error[hidden] { display: none; }

.auth-card .btn { width: 100%; margin-top: 16px; justify-content: center; }
.auth-note { margin: 14px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1240px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: 1fr; }
  .hide-lg { display: none; }
  .top-actions { gap: 8px; }
}

@media (max-width: 900px) {
  .topbar-inner, .wrap { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { flex-wrap: wrap; row-gap: 10px; }
  .topnav { order: 3; flex: 1 0 100%; justify-content: center; }
  .top-actions { margin-left: auto; }
  .brand-sub { max-width: 46vw; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .input, .filters .select { flex: 1 1 130px; width: auto; }
  .hide-md { display: none; }
  .col-time { width: 130px; }
  .ai-detail-grid { grid-template-columns: 1fr; }
  .ai-controls .btn { flex: 1 1 100%; justify-content: center; }
}

@media (max-width: 620px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 12px 13px; min-height: 84px; }
  .stat-value { font-size: 21px; }
  .panel { padding: 15px 14px; }
  .top-actions .muted, .live-dot { display: none; }
  .hide-sm { display: none; }
  .date-field input { width: 118px; }
  .brand-sub { max-width: 40vw; }
  .ai-controls { gap: 10px; }
  .ai-field { flex: 1 1 130px; min-width: 0; }
  .ai-switch-field { flex: 0 0 auto; }
  .ai-field .input, .ai-field .select { min-width: 0; width: 100%; }
  .seg button { padding: 5px 8px; }
  .schedule-label { display: none; }
  .schedule-btn { padding: 8px 10px; }
  .manage-label { display: none; }
  .manage-btn { padding: 8px 10px; }
  .schedule-time-row { flex-wrap: wrap; }
  .schedule-mode { grid-template-columns: 1fr; gap: 8px; }
}

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