@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --font-display: 'Outfit', 'Noto Sans SC', sans-serif;
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --ink: #0f1419;
  --ink-soft: #1a2332;
  --ink-muted: #3d4f66;
  --slate: #64748b;
  --mist: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --canvas-warm: #eef1f6;

  --brand: #e85d4a;
  --brand-deep: #c94a38;
  --brand-glow: rgba(232, 93, 74, 0.22);
  --brand-soft: #fff5f3;

  --success: #0d9f6e;
  --success-soft: #e8f8f1;
  --warn: #d97706;
  --warn-soft: #fffbeb;

  --shadow-xs: 0 1px 2px rgba(15, 20, 25, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 20, 25, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 20, 25, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 20, 25, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --sidebar-w: 252px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

[hidden] { display: none !important; }

body {
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.imei-modal-open {
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(232, 93, 74, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(26, 35, 50, 0.04), transparent 50%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-warm) 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* 全站唯一容器：hub.html 持有侧边栏，各业务页只作为右侧子页面运行。 */
.shell-layout {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.shell-main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.shell-home {
  height: 100%;
  overflow-x: clip;
  overflow-y: auto;
}

.shell-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--canvas);
}

.shell-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
  color: var(--slate);
  font-size: 14px;
  text-align: center;
}

.shell-state::before {
  content: '';
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: shellSpin 0.8s linear infinite;
  margin-bottom: 10px;
}

.shell-state.shell-error {
  color: var(--brand-deep);
}

.shell-state.shell-error::before {
  content: '!';
  display: grid;
  place-items: center;
  border: 0;
  background: var(--brand-soft);
  animation: none;
  font-weight: 800;
}

@keyframes shellSpin { to { transform: rotate(360deg); } }

.child-layout .main,
html.kdg-embedded .main {
  margin-left: 0;
}

/* —— Sidebar —— */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(175deg, #121820 0%, var(--ink-soft) 48%, #151c28 100%);
  color: #a8b4c4;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.sidebar-brand span {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 12px var(--brand-glow);
}

.sidebar nav {
  padding: 16px 12px 24px;
  flex: 1;
  overflow-y: auto;
}

.sidebar .nav-section {
  font-size: 10px;
  color: #5a6b7d;
  padding: 16px 12px 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  color: #8b9cb0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border-left: none;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.sidebar a::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.2s var(--ease), background 0.2s;
}

.sidebar a.nav-muted {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.72);
}

.sidebar a:hover {
  color: #e8edf4;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar a:hover::before { opacity: 0.7; transform: scale(1.1); }

.sidebar a.active {
  color: #fff;
  background: rgba(232, 93, 74, 0.14);
  box-shadow: inset 0 0 0 1px rgba(232, 93, 74, 0.25);
}

.sidebar a.active::before {
  opacity: 1;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand-glow);
}

.sidebar .disabled {
  padding: 8px 12px;
  font-size: 12px;
  color: #4a5a6a;
  cursor: not-allowed;
}

/* —— Main —— */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  /* 用 clip 而非 hidden：同样裁掉横向溢出，但不会把 .main 变成滚动容器，
     否则会让内部 position: sticky（页眉、用户指纹悬停分页栏）失效。 */
  overflow-x: clip;
}

.page-header {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-header-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  position: relative;
  padding-left: 14px;
  line-height: 1.25;
}

.page-header h1::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.page-header-desc {
  font-size: 13px;
  color: var(--slate);
  padding-left: 14px;
  line-height: 1.5;
  max-width: 560px;
}

.page-header-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(13, 159, 110, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
}

.page-header-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.25);
  animation: pulseDot 2s ease-in-out infinite;
}

.image-retrieval-header-env {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.image-retrieval-header-env span {
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.image-retrieval-header-env select {
  height: 34px;
  min-width: 104px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(0.92); }
}

.sidebar-share {
  margin-top: auto;
  padding: 14px 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-share-label {
  font-size: 10px;
  color: #5a6b7d;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}

.sidebar-share-url {
  display: block;
  font-size: 11px;
  line-height: 1.45;
  color: #7dd3fc;
  word-break: break-all;
  text-decoration: none;
  margin-bottom: 8px;
}

.sidebar-share-url:hover { text-decoration: underline; }

.sidebar-share-copy {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #e8edf4;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-share-copy:hover { background: rgba(255, 255, 255, 0.12); }

.share-url-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  background: linear-gradient(135deg, #e8f4fd 0%, #fff 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
}

.share-url-banner strong { color: var(--ink-soft); }

.share-url-banner a {
  color: #2563eb;
  font-weight: 600;
  word-break: break-all;
}

.share-url-copy {
  padding: 6px 14px;
  font-size: 12px;
  font-family: inherit;
  color: #fff;
  background: #2563eb;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.share-url-copy:hover { background: #1d4ed8; }

.sidebar-foot {
  margin-top: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-account-card {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.sidebar-account-card:hover,
.sidebar-account-card:focus-visible {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
}

.sidebar-account-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(232, 93, 74, 0.28);
  border-radius: 9px;
  background: rgba(232, 93, 74, 0.13);
  color: #f5b3aa;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.sidebar-account-meta {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sidebar-account-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e5ebf2;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}

.sidebar-account-role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #718196;
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0;
}

.sidebar-account-edit {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: #66768a;
  transition: color 0.15s;
}

.sidebar-account-edit svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-account-card:hover .sidebar-account-edit,
.sidebar-account-card:focus-visible .sidebar-account-edit {
  color: #d7e0ea;
}

.sidebar-logout {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #718196;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-logout:hover,
.sidebar-logout:focus-visible {
  background: rgba(232, 93, 74, 0.12);
  color: #fecaca;
  outline: none;
}

.sidebar-logout svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 手机专用账号按钮：默认隐藏，仅在窄屏 brand 行里显示 */
.sidebar-mobile-actions,
.sidebar-profile-mobile,
.sidebar-logout-mobile {
  display: none;
}

/* —— 当前账号个人信息 —— */
.account-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 20, 25, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.account-modal[hidden] { display: none !important; }

.account-modal-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 20, 25, 0.2);
}

.account-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.account-modal-head h2 { margin: 0; color: var(--ink); font-size: 20px; line-height: 1.35; }
.account-modal-close {
  width: 32px; height: 32px; flex-shrink: 0;
  border: 0; border-radius: 9px;
  background: var(--line-soft); color: var(--slate); cursor: pointer; font-size: 18px; line-height: 1;
}
.account-modal-close:hover { background: #e8edf3; color: var(--ink-muted); }
.account-modal-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border-radius: 11px;
  background: #f1f4f8;
}
.account-modal-tab {
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--slate);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
}
.account-modal-tab.is-active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 20, 25, 0.09);
  color: var(--ink);
}
.account-modal-tab:focus-visible { outline: 2px solid rgba(232, 93, 74, 0.3); outline-offset: 1px; }
.account-password-form { display: grid; gap: 16px; }
.account-tab-panel { display: grid; gap: 16px; }
.account-login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 12px;
}
.account-login-row span { color: var(--slate); }
.account-login-row strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--ink-muted); font-weight: 600; white-space: nowrap; }
.account-password-field { display: grid; gap: 7px; }
.account-password-field > label { color: var(--ink-muted); font-size: 12px; font-weight: 600; }
.account-password-form input {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid #d9e0e8; border-radius: 9px;
  background: #fff; color: var(--ink); font: inherit; font-size: 13px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.account-password-form input::placeholder { color: #a1aebe; }
.account-password-form input:focus { border-color: #ee8a7b; box-shadow: 0 0 0 3px rgba(232, 93, 74, 0.1); }
.password-input-wrap { position: relative; width: 100%; }
.password-input-wrap input { padding-right: 44px; }
.password-toggle {
  position: absolute; top: 50%; right: 7px; transform: translateY(-50%);
  width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--slate); cursor: pointer;
}
.password-toggle:hover, .password-toggle:focus-visible { background: var(--line-soft); color: var(--ink-muted); outline: none; }
.password-toggle.is-visible { color: var(--brand); }
.password-icon { display: inline-flex; width: 19px; height: 19px; }
.password-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.password-icon-visible { display: none; }
.password-toggle.is-visible .password-icon-hidden { display: none; }
.password-toggle.is-visible .password-icon-visible { display: inline-flex; }
.account-password-form small, .user-field small { color: var(--slate); font-size: 11px; line-height: 1.5; }
.account-password-status { padding: 9px 11px; border-radius: var(--radius-sm); font-size: 12px; line-height: 1.5; }
.account-password-status.loading { background: #eff6ff; color: #1d4ed8; }
.account-password-status.success { background: #ecfdf5; color: #047857; }
.account-password-status.error { background: #fff1f2; color: #be123c; }
.account-modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 2px; }
.account-modal-button {
  min-height: 38px; min-width: 72px; padding: 8px 16px; border-radius: 9px;
  cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
}
.account-modal-button:disabled { cursor: wait; opacity: 0.65; }
.account-modal-button.secondary { border: 1px solid var(--line); background: #fff; color: var(--ink-muted); }
.account-modal-button.secondary:hover { background: #f8fafc; color: var(--ink-muted); }
.account-modal-button.primary { min-width: 104px; border: 1px solid var(--brand); background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(232, 93, 74, 0.16); }
.account-modal-button.primary:hover { border-color: var(--brand-deep); background: var(--brand-deep); }

.kdg-ai-assistant {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 220;
  font-family: var(--font-body);
}

.kdg-ai-fab {
  width: 54px;
  height: 54px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #fff 0%, #f9e7df 100%);
  box-shadow: 0 16px 34px rgba(15, 20, 25, 0.24), 0 0 0 1px rgba(232, 93, 74, 0.14) inset;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.kdg-ai-fab img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.kdg-ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 20, 25, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.14) inset;
}

.kdg-ai-open .kdg-ai-fab {
  transform: scale(0.94);
}

.kdg-ai-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(430px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 112px));
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 70px rgba(15, 20, 25, 0.22);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 1;
  animation: aiPanelIn 0.18s var(--ease) both;
}

@keyframes aiPanelIn {
  from { transform: translateY(10px) scale(0.98); }
  to { transform: translateY(0) scale(1); }
}

.kdg-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
}

.kdg-ai-head strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.kdg-ai-head span {
  display: block;
  margin-top: 3px;
  color: var(--slate);
  font-size: 12px;
  line-height: 1.4;
}

.kdg-ai-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.kdg-ai-close:hover {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: rgba(232, 93, 74, 0.24);
}

.kdg-ai-log {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  background: linear-gradient(180deg, #f4f6fa 0%, #fff 100%);
}

.kdg-ai-msg {
  display: flex;
  margin-bottom: 12px;
}

.kdg-ai-msg-user {
  justify-content: flex-end;
}

.kdg-ai-msg-body {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
  word-break: break-word;
}

.kdg-ai-msg-user .kdg-ai-msg-body {
  color: #fff;
  background: var(--ink-soft);
  border-color: transparent;
}

.kdg-ai-meta {
  margin: -2px 0 12px;
  color: var(--mist);
  font-size: 11px;
  line-height: 1.5;
}

.kdg-ai-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 14px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.kdg-ai-attachments {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.kdg-ai-attachments[hidden] {
  display: none !important;
}

.kdg-ai-attachment {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.2;
}

.kdg-ai-attachment img {
  width: 32px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #fff;
}

.kdg-ai-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kdg-ai-attachment button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-muted);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.kdg-ai-attachment button:hover {
  color: var(--brand-deep);
  background: rgba(232, 93, 74, 0.1);
}

.kdg-ai-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.kdg-ai-form textarea {
  min-width: 0;
  max-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  outline: none;
}

.kdg-ai-form textarea:focus {
  border-color: rgba(232, 93, 74, 0.58);
  box-shadow: 0 0 0 3px rgba(232, 93, 74, 0.12);
}

.kdg-ai-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.kdg-ai-form button {
  align-self: end;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-sm);
  color: #fff;
  background: var(--brand);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.kdg-ai-form .kdg-ai-attach-btn {
  width: 44px;
  padding: 0;
  color: var(--ink-soft);
  background: #f8fafc;
  border: 1px solid var(--line);
}

.kdg-ai-form .kdg-ai-attach-btn:hover {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: rgba(232, 93, 74, 0.24);
}

.kdg-ai-form button:hover {
  background: var(--brand-deep);
}

.kdg-ai-form button:disabled,
.kdg-ai-form textarea:disabled {
  opacity: 0.62;
  cursor: wait;
}

.page-body {
  padding: 24px 32px 48px;
  animation: pageIn 0.5s var(--ease) both;
}

.icp-footer {
  padding: 0 32px 24px;
  text-align: center;
  color: var(--mist);
  font-size: 12px;
}

.icp-footer a {
  color: inherit;
  text-decoration: none;
}

.icp-footer a:hover {
  color: var(--ink-muted);
  text-decoration: underline;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Banners —— */
.gap-banner {
  background: linear-gradient(135deg, var(--warn-soft) 0%, #fff 100%);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.65;
  box-shadow: var(--shadow-xs);
}

.gap-banner strong { color: var(--warn); font-weight: 600; }
.gap-banner code {
  font-size: 12px;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

.gap-banner a { color: var(--brand-deep); font-weight: 600; }

/* —— Filters —— */
.filter-shell {
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  /* allow multiselect dropdown to overflow */
  overflow: visible;
}

.filter-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: linear-gradient(180deg, var(--line-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line-soft);
}

.filter-panel-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-soft) 0%, #fff 100%);
  border: 1px solid rgba(232, 93, 74, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}

.filter-panel-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-panel-title {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.filter-panel-hint {
  display: block;
  font-size: 12px;
  color: var(--mist);
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-bar.global-filters.filter-panel {
  padding: 16px 20px 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  box-shadow: none;
}

.filter-bar.global-filters,
.filter-panel {
  align-items: flex-end;
}

.global-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 20px;
}

.global-filters .filter-control > .ms { width: 100%; }
.global-filters .filter-item-ver.hidden { display: none; }

.global-filters .filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}

.global-filters .filter-item-date {
  min-width: 300px;
  flex: 0 1 auto;
}

.global-filters .filter-item-wide {
  min-width: 200px;
  flex: 1 1 220px;
}

.global-filters .filter-item-actions {
  min-width: auto;
  flex: 0 0 auto;
}

.global-filters .filter-item label {
  font-size: 11px;
  color: var(--slate);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.global-filters .filter-label-placeholder {
  visibility: hidden;
  user-select: none;
}

.global-filters .filter-control {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.global-filters .date-range-control {
  gap: 8px;
  flex-wrap: nowrap;
}

.global-filters .filter-sep-text {
  font-size: 13px;
  color: var(--mist);
  flex-shrink: 0;
}

.global-filters button.ghost {
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.global-filters button.ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.date-field-wrap {
  position: relative;
  flex: 1;
  min-width: 128px;
  max-width: 150px;
  cursor: pointer;
}

.date-field-wrap input[type="date"] {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
  background: var(--line-soft);
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.date-field-wrap input[type="date"]:hover,
.date-field-wrap input[type="date"]:focus {
  border-color: var(--brand);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.date-field-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

/* —— Multi-select —— */
.ms { position: relative; width: 100%; min-width: 150px; z-index: 1; }
.ms.ms-open { z-index: 200; }

.ms-trigger {
  width: 100%;
  height: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-soft);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.ms-trigger:hover {
  border-color: var(--brand);
  background: var(--surface);
}

.ms-trigger:disabled { opacity: 0.55; cursor: not-allowed; }
.ms-disabled .ms-trigger { opacity: 0.55; cursor: not-allowed; }

.ms-arrow { color: var(--mist); font-size: 11px; }

.ms-panel {
  position: absolute;
  z-index: 201;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  animation: panelIn 0.2s var(--ease);
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ms-panel[hidden] { display: none !important; }

.ms-search {
  margin: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--line-soft);
}

.ms-search:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
}

.ms-actions {
  display: flex;
  gap: 12px;
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.ms-link {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.ms-list { overflow-y: auto; padding: 6px 0; max-height: 200px; }

.ms-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

.ms-item:hover { background: var(--brand-soft); }

.ms-empty { padding: 14px; color: var(--mist); font-size: 12px; text-align: center; }

/* —— Stat cards —— */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: cardIn 0.45s var(--ease) both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand) 0%, #f4a261 100%);
}

.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--success) 0%, #34d399 100%); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%); }

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card .label {
  font-size: 11px;
  color: var(--slate);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.stat-card .value.num-lg { font-size: 22px; }

.stat-card .value.diff-up { color: var(--success); }
.stat-card .value.diff-down { color: var(--brand); }
.stat-card .value.diff-flat { color: var(--slate); }

.stat-card.stat-rate::after,
.stat-card.stat-pv::after,
.stat-card.stat-success::after,
.stat-card.stat-diff::after {
  content: '';
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  opacity: 0.12;
  pointer-events: none;
}

.stat-card.stat-rate::after {
  background: radial-gradient(circle at 30% 30%, var(--brand), transparent 70%);
}

.stat-card.stat-pv::after {
  background: radial-gradient(circle at 30% 30%, #3b82f6, transparent 70%);
}

.stat-card.stat-success::after {
  background: radial-gradient(circle at 30% 30%, var(--success), transparent 70%);
}

.stat-card.stat-diff::after {
  background: radial-gradient(circle at 30% 30%, #8b5cf6, transparent 70%);
}

.section-block { margin-bottom: 22px; }

.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}

.filter-toolbar label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
}

.filter-toolbar select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  min-width: 88px;
}

.filter-toolbar select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.tool-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.tool-bar label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  letter-spacing: 0.03em;
}

.tool-bar select,
.tool-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--line-soft);
  color: var(--ink);
  cursor: pointer;
  min-width: 88px;
}

.tool-bar select:focus,
.tool-select:focus {
  outline: none;
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

/* —— Charts —— */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s var(--ease);
  animation: cardIn 0.5s var(--ease) both;
}

.chart-card:hover { box-shadow: var(--shadow-md); }

.chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 4px;
}

.chart-card .sub {
  font-size: 12px;
  color: var(--mist);
  line-height: 1.45;
}

.chart-card:not(:has(.chart-card-head)) h3 { margin-bottom: 4px; }
.chart-card:not(:has(.chart-card-head)) .sub { margin-bottom: 16px; }

.chart-card canvas { max-height: 260px; }

.chart-card.chart-wide {
  grid-column: 1 / -1;
}

.chart-card.chart-wide canvas {
  max-height: 320px;
}

/* —— 智能体监控页 —— */
.agent-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.agent-tab {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s, background 0.2s, box-shadow 0.2s;
}

.agent-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.agent-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

.agent-panel[hidden] { display: none !important; }

.agent-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.agent-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}

.agent-kpi .kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 6px;
}

.agent-kpi .kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.agent-kpi.warn .kpi-value { color: var(--brand); }

.alert-section {
  margin-bottom: 18px;
}

.alert-section h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
}

.alert-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.alert-section-head h3 {
  margin: 0;
}

.alert-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alert-filter-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.alert-filter-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.alert-filter-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

/* —— 智能体任务页：上升/下降 —— */
.task-page-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.task-page-bar-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.task-page-bar-dates {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-page-bar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
}

.task-page-bar-dates strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}

.task-page-bar-rule {
  font-size: 12px;
  color: var(--mist);
  margin: 12px 0 0;
  line-height: 1.45;
}

.task-agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.task-agent-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.task-agent-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.task-agent-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
}

.task-change-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .task-change-grid {
    grid-template-columns: 1fr;
  }
}

.task-change-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  min-height: 200px;
}

.task-change-panel.up {
  border-top: 3px solid var(--success);
}

.task-change-panel.down {
  border-top: 3px solid #e85d4a;
}

.task-change-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.task-change-panel-head h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.task-change-count {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.task-change-panel.up .task-change-count {
  color: var(--success);
}

.task-change-panel.down .task-change-count {
  color: #e85d4a;
}

.task-change-hint {
  font-size: 12px;
  color: var(--mist);
  margin: 0 0 12px;
}

.task-change-empty {
  font-size: 13px;
  color: var(--mist);
  padding: 24px 0;
  text-align: center;
  margin: 0;
}

.task-change-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.task-change-card {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.task-change-panel.down .task-change-card {
  background: linear-gradient(135deg, #fff8f6 0%, #fff 100%);
  border-color: rgba(232, 93, 74, 0.2);
}

.task-change-panel.up .task-change-card {
  background: linear-gradient(135deg, #f0fdf8 0%, #fff 100%);
  border-color: rgba(13, 159, 110, 0.2);
}

.task-change-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.task-change-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}

.task-change-delta {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
}

.task-change-delta.up {
  background: var(--success-soft);
  color: var(--success);
}

.task-change-delta.down {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.task-change-meta {
  font-size: 11px;
  color: var(--slate);
  margin: 0;
  line-height: 1.5;
}

.task-change-fails {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.version-baseline-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--slate);
}

.version-baseline-pick span {
  font-weight: 600;
}

.version-baseline-select {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  min-width: 140px;
}

.version-compare-warn {
  font-size: 13px;
  color: var(--brand-deep);
  font-weight: 600;
}

.version-compare-note {
  font-size: 12px;
  color: var(--mist);
  margin: 10px 0 0;
  line-height: 1.5;
}

.metrics-toolbar {
  margin-bottom: 14px;
}

/* 版本任务指标表：复用每日明细可排序表头样式 */
.metrics-task-table .daily-sort-th {
  padding: 0;
  vertical-align: middle;
}

.metrics-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 24px;
}

.metrics-filter-bar--table {
  padding: 12px 14px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.metrics-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.metrics-filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  flex-shrink: 0;
}

.metrics-ver-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-height: 88px;
  overflow-y: auto;
}

.metrics-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}

.metrics-check input {
  accent-color: var(--brand);
}

.metrics-filter-empty {
  font-size: 12px;
  color: var(--mist);
}

.metrics-table-agent-tabs {
  flex-wrap: wrap;
}

.table-wrap > h3 {
  margin-bottom: 12px;
}

/* —— 设备留存页（新版） —— */

/* ── 视图切换紧凑条 ── */
#retViewControls {
  margin-top: -8px;
  margin-bottom: 18px;
}

.ret-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px 18px;
  background: linear-gradient(135deg, var(--brand-soft) 0%, #fff8f6 100%);
  border: 1px solid rgba(232, 93, 74, 0.18);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 2px 6px rgba(232, 93, 74, 0.06);
}

.ret-view-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ret-view-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--slate);
  white-space: nowrap;
}

.ret-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(232, 93, 74, 0.2);
  border-radius: var(--radius-sm);
}

.ret-seg-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.ret-seg-btn:hover:not(.active) {
  color: var(--brand-deep);
  background: rgba(232, 93, 74, 0.08);
}

.ret-seg-btn.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

/* ── 本期快照卡片 ── */
.ret-exec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.ret-exec-header {
  margin-bottom: 14px;
}

.ret-exec-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ret-exec-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.ret-exec-sub {
  margin: 0;
  font-size: 12px;
  color: var(--mist);
}

.ret-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.ret-chip.ok      { background: var(--success-soft); color: var(--success); }
.ret-chip.danger  { background: var(--brand-soft);   color: var(--brand-deep); }
.ret-chip.warning { background: #fff7ed;              color: #c2410c; }

/* KPI卡片行 */
.retention-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.retention-kpi {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.retention-kpi .kpi-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 5px;
}

.retention-kpi .kpi-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.retention-kpi .kpi-sub {
  font-size: 11px;
  color: var(--mist);
  margin-top: 3px;
}

.retention-kpi-delta {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
}

.retention-kpi-delta.up   { background: var(--success-soft); color: var(--success); }
.retention-kpi-delta.down { background: var(--brand-soft);   color: var(--brand-deep); }

/* 内联异常列表 */
.ret-alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.ret-alert-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--line-soft);
}

.ret-alert-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
  color: var(--ink);
}

.ret-alert-item p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--slate);
}

.ret-alert-dot {
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
  flex-shrink: 0;
}

.ret-alert-item.ok      .ret-alert-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.ret-alert-item.danger  { background: #fff7f5; border-color: rgba(232,93,74,.25); }
.ret-alert-item.danger  .ret-alert-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.ret-alert-item.warning { background: #fffbeb; border-color: rgba(217,119,6,.2); }
.ret-alert-item.warning .ret-alert-dot { background: #d97706; box-shadow: 0 0 0 3px #fef3c7; }
.ret-alert-item.info    .ret-alert-dot { background: #2563eb; box-shadow: 0 0 0 3px #dbeafe; }

/* ── 热力表 ── */
.retention-heat-panel { margin-bottom: 0; }

.retention-heat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-sm);
}

.ret-heat-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ret-section-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.ret-section-sub {
  margin: 0;
  font-size: 12px;
  color: var(--mist);
  line-height: 1.5;
  max-width: 52em;
}

.retention-heat-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--mist);
  flex-shrink: 0;
}

.retention-heat-legend-bar {
  width: 80px;
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, #fef2f2 0%, #fffbeb 35%, #ecfdf5 70%, #d1fae5 100%);
  border: 1px solid var(--line);
}

.retention-heat-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

table.retention-heat {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table.retention-heat th,
table.retention-heat td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  text-align: center;
}

table.retention-heat tbody tr:last-child td { border-bottom: none; }

table.retention-heat tbody tr:hover td:not(.retention-cell) {
  background: rgba(241,245,249,0.5);
}

table.retention-heat th:first-child,
table.retention-heat td:first-child,
table.retention-heat td.name-cell {
  text-align: left;
  font-weight: 600;
  color: var(--ink-muted);
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 2px 0 6px rgba(15,20,25,.04);
}

table.retention-heat thead th {
  background: linear-gradient(180deg, #f8fafc 0%, var(--line-soft) 100%);
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

table.retention-heat td.num:not(.retention-cell) {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
}

table.retention-heat td.sample-low {
  color: #c2410c;
  font-weight: 700;
  background: #fff7ed;
}

.retention-cell {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.retention-cell span,
.retention-cell small { display: block; }

.retention-cell small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: currentColor;
  opacity: 0.7;
}

.retention-cell.na {
  color: var(--mist);
  font-weight: 500;
  background: repeating-linear-gradient(-45deg,#f8fafc,#f8fafc 4px,#f1f5f9 4px,#f1f5f9 8px) !important;
}

.retention-cell.h1 { background: #fef2f2; color: #b91c1c; }
.retention-cell.h2 { background: #fff7ed; color: #c2410c; }
.retention-cell.h3 { background: #fffbeb; color: #a16207; }
.retention-cell.h4 { background: #ecfdf5; color: #047857; }
.retention-cell.h5 { background: #d1fae5; color: #065f46; }

/* 热力表与下方分析区之间补间距 */
#retPostTable { margin-top: 20px; }

/* ── 趋势+分析区 ── */
.ret-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

@media (max-width: 900px) {
  .ret-dual-grid { grid-template-columns: 1fr; }
}

/* ── 合并分析卡片 ── */
.ret-analysis-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.ret-analysis-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .ret-analysis-top { grid-template-columns: 1fr; }
}

/* 对比表格 */
.ret-cmp-table-wrap { margin-top: 14px; overflow-x: auto; }

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

.ret-cmp-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--mist);
  padding: 0 10px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.ret-cmp-table thead th.num { text-align: right; }

.ret-cmp-table tbody td {
  padding: 10px 10px 10px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink);
}

.ret-cmp-table tbody tr:last-child td { border-bottom: none; }

.ret-cmp-table td.num { text-align: right; }

.ret-cmp-th {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.ret-cmp-note {
  font-size: 11px;
  color: var(--mist);
  line-height: 1.45;
  max-width: 200px;
}

/* 系统分析区 */
.ret-analysis-right { border-left: 1px solid var(--line); padding-left: 20px; }

@media (max-width: 900px) {
  .ret-analysis-right { border-left: none; border-top: 1px solid var(--line); padding-left: 0; padding-top: 16px; }
}

.ret-insight-rows { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

.ret-insight-row {
  padding: 12px 14px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.ret-insight-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ret-insight-row-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.ret-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

/* 趋势图内部 */
.ret-trend-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ret-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.ret-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--slate);
}

.ret-legend-item i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

/* 新用户vs活跃用户对比 */
.ret-cmp-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.ret-cmp-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-soft);
}

.ret-cmp-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.ret-cmp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12px;
  color: var(--slate);
  margin-bottom: 8px;
}

.ret-cmp-row b {
  color: var(--ink);
  font-size: 14px;
}

.ret-cmp-gap {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
}

.ret-cmp-gap.up   { background: var(--success-soft); color: var(--success); }
.ret-cmp-gap.down { background: var(--brand-soft);   color: var(--brand-deep); }
.ret-cmp-gap.flat { background: var(--line-soft);    color: var(--slate); }

/* ── 规则分析（可折叠） ── */
.ret-insights-details,
.ret-definition-details {
  margin-bottom: 14px;
}

.ret-insights-details > summary,
.ret-definition-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ret-insights-details[open] > summary,
.ret-definition-details[open] > summary {
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
}

.ret-insights-details > summary::-webkit-details-marker,
.ret-definition-details > summary::-webkit-details-marker { display: none; }

.ret-summary-hint {
  font-weight: 400;
  color: var(--mist);
  font-size: 12px;
}

.ret-insights-wrap {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.retention-insight-card {
  background: linear-gradient(180deg, var(--line-soft) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.retention-insight-card:hover {
  border-color: rgba(232,93,74,.2);
  box-shadow: var(--shadow-sm);
}

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

.retention-insight-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.retention-insight-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.retention-insight-badge.up   { background: var(--success-soft); color: var(--success); }
.retention-insight-badge.down { background: var(--brand-soft);   color: var(--brand-deep); }
.retention-insight-badge.flat { background: var(--line-soft);    color: var(--slate); }

.retention-insight-def {
  font-size: 12px;
  color: var(--mist);
  line-height: 1.5;
  margin: 0 0 8px;
}

.retention-insight-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.55;
}

.retention-insight-list li + li { margin-top: 5px; }

/* ── 口径说明 ── */
.ret-definition-details > div,
.ret-definition-grid {
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 20px;
}

.ret-definition-grid b {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.ret-definition-grid span {
  display: block;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.5;
}

.retention-metric-note {
  font-size: 12px;
  color: var(--mist);
  margin: 10px 0 0;
  line-height: 1.5;
  grid-column: 1 / -1;
}

.retention-kpi-empty {
  font-size: 12px;
  color: var(--mist);
  margin: 10px 0 0;
  line-height: 1.5;
}

/* (retention styles consolidated above) */

.alert-card {
  background: linear-gradient(135deg, #fff8f6 0%, #fff 100%);
  border: 1px solid rgba(232, 93, 74, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.alert-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.alert-card-head strong {
  font-size: 15px;
  color: var(--ink);
}

.alert-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.alert-metrics {
  font-size: 13px;
  color: var(--slate);
}

.alert-metrics em {
  font-style: normal;
  font-weight: 700;
  color: var(--brand);
}

.alert-fails {
  margin: 10px 0 12px;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
}

.alert-suggestions {
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.alert-suggestions h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alert-suggestions ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.65;
}

.agent-empty-hint {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(13, 159, 110, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.table-wrap .row-alert td {
  background: #fff9f8;
}

.tag-drop {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.tag-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--success-soft);
  color: var(--success);
}

.agent-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.agent-mini-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1280px) {
  .agent-mini-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .agent-mini-grid--4 {
    grid-template-columns: 1fr;
  }
}

.agent-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.agent-rate-row {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  overflow: visible;
}

.agent-rate-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.agent-rate-row-head h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.agent-rate-row-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 4px 10px;
  border-radius: 20px;
}

.agent-mini-chart {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px 8px;
  overflow: visible;
}

.agent-mini-chart h4 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.agent-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.agent-mini-head h4 {
  margin: 0;
}

.agent-mini-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-soft);
  padding: 2px 8px;
  border-radius: 20px;
}

.agent-rate-mini .agent-drop-panel.compact {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.agent-drop-none.mini {
  font-size: 11px;
  margin: 0;
  line-height: 1.4;
}

.agent-drop-tabs {
  font-size: 12px;
}

.mini-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.mini-tab,
.mini-subtab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.3;
}

.mini-tab:hover,
.mini-subtab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.mini-tab.active,
.mini-subtab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
}

.mini-tab-panels .mini-tab-panel {
  display: none;
}

.mini-tab-panels .mini-tab-panel.active {
  display: block;
}

.drop-date-summary {
  font-size: 11px;
  color: var(--slate);
  margin: 0 0 8px;
  line-height: 1.45;
}

.mini-subtab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}

.mini-subtab-body {
  max-height: 140px;
  overflow-y: auto;
  padding-right: 2px;
}

.mini-subtab-panel {
  display: none;
}

.mini-subtab-panel.active {
  display: block;
}

.task-drop-list.compact {
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-drop-list.compact li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
  line-height: 1.45;
}

.task-drop-list.compact li:last-child {
  border-bottom: none;
}

.task-drop-list.compact .task-drop-meta {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--mist);
}

.mini-chart-wrap {
  position: relative;
  height: 200px;
  overflow: visible;
}

.mini-chart-wrap--wide {
  height: 220px;
}

.chart-card .mini-chart-wrap canvas {
  max-height: none;
}

.agent-drop-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.agent-drop-none {
  font-size: 13px;
  color: var(--mist);
  margin: 0;
}

.agent-drop-day {
  background: linear-gradient(135deg, #fff8f6 0%, #fff 100%);
  border: 1px solid rgba(232, 93, 74, 0.22);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.agent-drop-day:last-child {
  margin-bottom: 0;
}

.agent-drop-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.agent-drop-tasks-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin: 10px 0 8px;
  letter-spacing: 0.02em;
}

.alert-fails.compact {
  margin: 0 0 8px;
}

.drop-suggestions {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.6;
}

.agent-wow-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.agent-wow-head h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.agent-wow-sub {
  font-size: 13px;
  color: var(--slate);
  margin-bottom: 14px;
  line-height: 1.5;
}

.agent-wow-sub strong {
  color: var(--ink);
  font-weight: 700;
}

.agent-wow-table-wrap {
  overflow-x: auto;
}

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

.agent-wow-table th,
.agent-wow-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

.agent-wow-table th.num,
.agent-wow-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.agent-wow-table thead th {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--line-soft);
}

.agent-wow-hint {
  font-size: 12px;
  color: var(--mist);
  margin: 12px 0 0;
  line-height: 1.5;
}

.agent-wow-empty {
  font-size: 13px;
  color: var(--mist);
  margin: 0;
}

.alert-tasks {
  margin: 12px 0 14px;
  padding: 12px 14px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(232, 93, 74, 0.35);
}

.alert-tasks h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 10px;
}

.task-drop-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-drop-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.5;
}

.task-drop-list li:last-child { border-bottom: none; }

.task-drop-meta {
  display: block;
  font-size: 12px;
  color: var(--mist);
  margin-top: 4px;
}

.task-link {
  color: var(--brand-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(232, 93, 74, 0.45);
}

.task-link:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.alert-tasks-empty {
  font-size: 13px;
  color: var(--mist);
  margin: 8px 0 0;
}

.charts-grid.charts-grid--version-stack .chart-card--version.chart-wide + .chart-card--version.chart-wide {
  margin-top: 0;
}

/* —— Tables —— */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  margin-bottom: 20px;
}

.table-wrap h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--ink);
}

.daily-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.daily-table-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.daily-table-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.daily-table-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.daily-table-tab:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.daily-table-tab.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

.daily-sort-th {
  padding: 0;
  white-space: nowrap;
}

.daily-sort-th.num {
  text-align: right;
}

.daily-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  text-align: left;
}

.daily-sort-th.num .daily-sort-btn {
  justify-content: flex-end;
  text-align: right;
}

.daily-sort-btn:hover {
  color: var(--brand-deep);
  background: var(--line-soft);
}

.daily-sort-th.is-active .daily-sort-btn {
  color: var(--brand-deep);
}

.daily-sort-icon {
  font-size: 10px;
  opacity: 0.55;
  line-height: 1;
}

.daily-sort-th.is-active .daily-sort-icon {
  opacity: 1;
  color: var(--brand);
}

.daily-table-wrap table th.col-expand,
.daily-table-wrap table td.col-expand {
  width: 36px;
  padding-left: 8px;
  padding-right: 4px;
  text-align: center;
}

.daily-expand-btn,
.daily-row-expand {
  border: none;
  background: transparent;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.daily-row-expand-placeholder {
  color: var(--mist);
  font-size: 12px;
}

tr.daily-data-row.is-expandable {
  cursor: pointer;
}

tr.daily-data-row.is-expandable:hover td {
  background: var(--line-soft);
}

tr.daily-data-row.is-open td {
  background: var(--brand-soft);
}

.daily-fail-panel {
  margin: 4px 0 8px;
}

.daily-fail-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin: 12px 0 8px;
}

.daily-fail-table {
  width: 100%;
  max-width: 640px;
  font-size: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  border-collapse: collapse;
}

.daily-fail-table th,
.daily-fail-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.daily-fail-table tr:last-child td {
  border-bottom: none;
}

tr.daily-detail-row td {
  padding: 0 12px 14px 44px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}

/* —— Weekly expandable rows (reuse daily table affordance) —— */
.weekly-table-wrap table th.col-expand,
.weekly-table-wrap table td.col-expand {
  width: 36px;
  padding-left: 8px;
  padding-right: 4px;
  text-align: center;
}

.weekly-expand-btn {
  border: none;
  background: transparent;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

tr.weekly-data-row.is-expandable {
  cursor: pointer;
}

tr.weekly-data-row.is-expandable:hover td {
  background: var(--line-soft);
}

tr.weekly-data-row.is-open td {
  background: var(--brand-soft);
}

tr.weekly-detail-row td {
  padding: 0 12px 14px 44px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}

/* —— Summary expandable rows —— */
.summary-table-wrap table th.col-expand,
.summary-table-wrap table td.col-expand {
  width: 36px;
  padding-left: 8px;
  padding-right: 4px;
  text-align: center;
}

.summary-expand-btn {
  border: none;
  background: transparent;
  color: var(--slate);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

tr.summary-data-row.is-expandable { cursor: pointer; }
tr.summary-data-row.is-expandable:hover td { background: var(--line-soft); }
tr.summary-data-row.is-open td { background: var(--brand-soft); }

tr.summary-detail-row td {
  padding: 0 12px 14px 44px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}

.daily-fail-detail-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin: 12px 0 8px;
}

.daily-fail-detail-table {
  width: 100%;
  max-width: 640px;
  font-size: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.daily-fail-detail-table th,
.daily-fail-detail-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.daily-fail-detail-table tr:last-child td {
  border-bottom: none;
}

.daily-fail-empty {
  margin: 12px 0;
  font-size: 12px;
  color: var(--mist);
}

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

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}

th {
  background: var(--line-soft);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

th.num, td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
  font-weight: 600;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: var(--brand-soft); }
tbody tr:last-child td { border-bottom: none; }

td.name-cell {
  font-weight: 500;
  color: var(--ink);
  max-width: 220px;
}

.rate-low { color: var(--brand); font-weight: 700; font-family: var(--font-display); }
.rate-ok { color: var(--success); font-weight: 600; font-family: var(--font-display); }

.loading {
  text-align: center;
  padding: 48px 24px;
  color: var(--slate);
  font-size: 14px;
}

.loading::before {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* —— Hub —— */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.hub-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}

.hub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), #f4a261);
}

.hub-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(232, 93, 74, 0.25);
}

.hub-card.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.hub-card.disabled::before { background: var(--mist); }

.hub-card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.hub-card p { font-size: 13px; color: var(--slate); line-height: 1.6; }

.hub-card .tag {
  display: inline-block;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--line-soft);
  color: var(--slate);
}

.hub-card .tag.ok { background: var(--success-soft); color: var(--success); }
.hub-card .tag.warn { background: var(--brand-soft); color: var(--brand-deep); }

.legend {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--slate);
  font-weight: 500;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .shell-layout { height: 100vh; height: 100dvh; }
  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    width: 100%;
    height: auto;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  }
  .main { margin-left: 0; }
  .shell-main { flex: 1; height: auto; min-height: 0; }
  .sidebar-brand { flex: 1; min-width: 200px; border-bottom: none; }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
    width: 100%;
  }
  .sidebar a { margin-bottom: 0; padding: 8px 12px; font-size: 12px; }
  .page-body { padding: 16px 20px 32px; }
  .page-header { padding: 16px 20px; }
}

@media (max-width: 640px) {
  .sidebar {
    display: block;
    max-height: 116px;
    overflow: hidden;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 18px rgba(15, 20, 25, 0.18);
  }

  .sidebar-brand {
    min-width: 0;
    padding: 12px 16px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .sidebar-brand h2 {
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .sidebar-brand span {
    margin-top: 0;
    flex-shrink: 0;
    padding: 4px 9px;
  }

  .sidebar-mobile-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .sidebar-profile-mobile,
  .sidebar-logout-mobile {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 12px;
    line-height: 1;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
  }

  .sidebar-profile-mobile:active {
    background: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
  }

  .sidebar-logout-mobile:active {
    background: rgba(232, 93, 74, 0.2);
    color: #fecaca;
    border-color: rgba(232, 93, 74, 0.35);
  }

  .sidebar nav {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 0 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav-section,
  .sidebar .disabled,
  .sidebar-foot {
    display: none;
  }

  .sidebar a {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding: 7px 10px;
    gap: 7px;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    border-radius: 999px;
  }

  .sidebar a::before {
    width: 5px;
    height: 5px;
  }

  .main {
    margin-left: 0;
  }

  .page-header {
    padding: 12px 16px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .page-body {
    padding: 12px 12px 28px;
  }

  .icp-footer {
    padding: 0 12px 16px;
    font-size: 11px;
  }
}

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

.ms-trigger:focus-visible,
.global-filters button.ghost:focus-visible,
.sidebar a:focus-visible,
.hub-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* —— 用户维度查询 —— */
.page-user-imei .section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--ink);
}

.user-imei-filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.user-imei-filter-grid {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(120px, 1fr)) auto;
  gap: 12px 14px;
  align-items: end;
}

.user-imei-field span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  margin-bottom: 6px;
}

.user-imei-field input,
.user-imei-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
}

.user-imei-field-imei input {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: 0.02em;
}

.user-imei-input-dim {
  background: var(--line-soft) !important;
  color: var(--slate) !important;
  cursor: pointer !important;
}

.user-imei-imei-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--mist);
  margin-left: 6px;
}

.user-imei-filter-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 1px;
}

.user-imei-filter-actions button {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
}

.user-imei-filter-actions .btn-primary {
  background: var(--brand);
  color: #fff;
}

.user-imei-filter-actions .btn-primary:hover {
  background: var(--brand-deep);
}

.user-imei-filter-actions .btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-muted);
}

.user-imei-filter-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--mist);
  line-height: 1.5;
}

.user-imei-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--slate);
  margin-top: 4px;
}

.user-imei-activation {
  margin-top: 14px;
  font-size: 13px;
}

.user-imei-activation summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-muted);
}

.user-imei-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin-top: 10px;
}

.user-imei-dl dt { color: var(--slate); }
.user-imei-dl dd { color: var(--ink); }

.user-imei-issues {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 10px;
}

.user-imei-issue-card {
  padding: 14px 16px;
}

.user-imei-issue-card .user-imei-suggest {
  margin-top: 8px;
  padding-left: 18px;
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.user-imei-agent-filter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms var(--ease), border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}

.user-imei-agent-filter:hover {
  border-color: rgba(232, 93, 74, 0.28);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.user-imei-agent-filter:active {
  transform: translateY(0);
}

.user-imei-task-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 12px 0 14px;
}

.user-imei-task-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-imei-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.user-imei-tab.active {
  background: var(--brand-soft);
  border-color: rgba(232, 93, 74, 0.25);
  color: var(--brand-deep);
}

.user-imei-slow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  user-select: none;
}

.user-imei-slow-toggle input {
  width: 16px;
  height: 16px;
}

.user-imei-task-note {
  font-size: 12px;
  color: var(--mist);
  line-height: 1.4;
}

.user-imei-dur-flag {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.user-imei-dur-flag.up {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.user-imei-dur-flag.down {
  background: var(--line-soft);
  color: var(--slate);
}

.user-imei-cmp {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}

.user-imei-cmp.up {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.user-imei-cmp.down {
  background: var(--success-soft);
  color: var(--success);
}

.user-imei-cmp.muted {
  background: var(--line-soft);
  color: var(--mist);
}

.user-imei-row-slow td {
  background: #fff8f6;
}

/* 任务明细：复制按钮不显示边框/下划线 */
.user-imei-copy-reason {
  border: 0 !important;
  border-bottom: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  cursor: pointer;
}

.user-imei-agent-table .row-warn td {
  background: var(--brand-soft);
}

.user-imei-fail-top {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.user-imei-fail-top .muted {
  list-style: none;
  margin-left: -16px;
  color: var(--mist);
}

.user-imei-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.user-imei-status.ok {
  background: var(--success-soft);
  color: var(--success);
}

.user-imei-status.fail {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.user-imei-status.other {
  background: var(--line-soft);
  color: var(--slate);
}

.user-imei-row-fail {
  cursor: pointer;
}

.user-imei-row-fail:hover td {
  background: #fff8f6;
}

.user-imei-reason-cell {
  max-width: 360px;
}

.user-imei-reason-text {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

.user-imei-trace-id code {
  font-size: 11px;
  word-break: break-all;
}

.user-imei-tasks-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.user-imei-tasks-head .section-title {
  margin-bottom: 0;
}

.user-imei-tasks-meta {
  font-size: 13px;
  color: var(--slate);
}

.user-imei-pager {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.user-imei-pager .btn-ghost {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.user-imei-pager .btn-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.user-imei-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 20, 25, 0.45);
  display: flex;
  justify-content: flex-end;
}

.user-imei-drawer[hidden] {
  display: none !important;
}

.user-imei-drawer-inner {
  width: min(480px, 100%);
  height: 100%;
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  overflow: auto;
}

.user-imei-drawer-inner h4 {
  font-family: var(--font-display);
  margin-bottom: 12px;
}

.user-imei-drawer-inner pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  background: var(--line-soft);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.user-imei-drawer-close {
  position: absolute;
  top: 16px;
  right: 20px;
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--slate);
}

.user-imei-drawer-inner {
  position: relative;
}

/* —— IMEI 任务时间线 —— */
.page-imei-timeline .section-block {
  margin-bottom: 18px;
}

.imei-timeline-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(3, auto);
  gap: 10px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.image-retrieval-search {
  grid-template-columns:
    minmax(180px, 210px)
    minmax(260px, 1fr)
    minmax(220px, 240px)
    minmax(220px, 240px)
    minmax(66px, auto);
  grid-template-areas:
    "image-mode image-mode image-mode image-mode image-mode"
    "image-imei image-range image-start image-end image-action";
  gap: 12px;
}

.image-retrieval-mode-row { grid-area: image-mode; }
.image-retrieval-imei { grid-area: image-imei; }
.image-retrieval-env { grid-area: image-env; }
.image-retrieval-account-type { grid-area: image-account-type; }
.image-retrieval-work-account { grid-area: image-work; }
.image-retrieval-page-size { grid-area: image-page-size; }
.image-retrieval-nick-search { grid-area: image-nick; }
.image-retrieval-oss-key { grid-area: image-oss-key; }
.image-retrieval-time-range { grid-area: image-range; }
.image-retrieval-start { grid-area: image-start; }
.image-retrieval-end { grid-area: image-end; }
.image-retrieval-actions { grid-area: image-action; }
.image-retrieval-action { grid-area: image-action; }

.image-retrieval-search.is-fingerprint {
  grid-template-columns:
    minmax(180px, 210px)
    minmax(116px, 140px)
    minmax(260px, 1fr)
    minmax(220px, 260px)
    minmax(86px, 110px)
    minmax(380px, auto);
  grid-template-areas:
    "image-mode image-mode image-mode image-mode image-mode image-mode"
    "image-imei image-account-type image-work image-nick image-page-size image-action";
}

.image-retrieval-search.is-oss {
  grid-template-columns:
    minmax(220px, 1fr)
    minmax(66px, auto);
  grid-template-areas:
    "image-mode image-mode"
    "image-oss-key image-action";
}

.image-retrieval-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.image-retrieval-mode {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.image-retrieval-mode button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--slate);
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.image-retrieval-mode button.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

.image-retrieval-cache-refresh {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: #1d4ed8;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.image-retrieval-cache-refresh:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #dbeafe;
}

.image-retrieval-cache-refresh:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.cache-refresh-label-short {
  display: none;
}

.imei-timeline-search .imei-suggest-field {
  position: relative;
}

.imei-timeline-field span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 6px;
}

.imei-timeline-field input,
.imei-timeline-field select {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  box-sizing: border-box;
}

.imei-timeline-field select {
  font-family: inherit;
}

.page-image-retrieval .imei-timeline-field {
  min-width: 0;
}

.page-image-retrieval .image-retrieval-imei {
  position: relative;
}

.page-image-retrieval .image-retrieval-work-account {
  position: relative;
}

.page-image-retrieval .imei-timeline-field input,
.page-image-retrieval .imei-timeline-field select {
  height: 40px;
  min-height: 40px;
}

.image-retrieval-account-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 6px;
}

.image-retrieval-account-dropdown {
  position: absolute;
  z-index: 36;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.image-retrieval-account-option {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.image-retrieval-account-option:hover,
.image-retrieval-account-option.is-active {
  border-color: rgba(232, 93, 74, 0.28);
  background: var(--brand-soft);
}

.image-retrieval-imei-suggestions {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 300px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

/* 数据召回页：历史候选下拉加宽，不再跟随窄输入框宽度（时间线页不带 page-image-retrieval，保持原宽） */
.page-image-retrieval .image-retrieval-imei-suggestions {
  right: auto;
  width: max(100%, 380px);
  max-width: min(520px, calc(100vw - 48px));
}

.imei-suggest-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 6px;
  margin: -8px -8px 6px;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.imei-suggest-tab {
  flex: 1;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--slate);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.imei-suggest-tab.is-active {
  border-color: rgba(232, 93, 74, 0.28);
  background: var(--brand-soft);
  color: var(--brand);
}

.imei-suggest-empty {
  padding: 14px 12px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.image-retrieval-imei-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.image-retrieval-imei-option:hover {
  border-color: rgba(232, 93, 74, 0.28);
  background: var(--brand-soft);
}

.image-retrieval-imei-option strong {
  display: block;
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 800;
  word-break: break-word;
}

.image-retrieval-imei-option span {
  margin: 0;
  color: var(--slate);
  font-size: 12px;
  font-weight: 600;
}

.datetime-picker {
  position: relative;
  display: flex;
  width: 100%;
}

.datetime-picker .datetime-picker-display {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  cursor: pointer;
}

.datetime-picker.is-open .datetime-picker-display {
  border-color: rgba(232, 93, 74, 0.38);
  box-shadow: 0 0 0 3px rgba(232, 93, 74, 0.10);
}

.datetime-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(320px, calc(100vw - 48px));
  padding: 12px;
  border: 1px solid rgba(211, 222, 236, 0.95);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(31, 41, 55, 0.16);
}

.image-retrieval-end .datetime-picker-panel {
  left: auto;
  right: 0;
}

.datetime-panel-head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.datetime-panel-head strong {
  text-align: center;
  font-size: 14px;
  color: var(--ink);
}

.datetime-nav {
  position: relative;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.datetime-nav::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--slate);
  border-bottom: 2px solid var(--slate);
  transform: rotate(45deg);
}

.datetime-nav.is-next::before {
  left: 10px;
  transform: rotate(-135deg);
}

.datetime-nav:disabled,
.datetime-day:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.datetime-weekdays,
.datetime-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.datetime-weekdays {
  margin-bottom: 6px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.datetime-day,
.datetime-day-spacer {
  height: 34px;
}

.datetime-day {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.datetime-day:hover:not(:disabled) {
  border-color: rgba(232, 93, 74, 0.24);
  background: var(--brand-soft);
}

.datetime-day.is-today {
  border-color: rgba(86, 143, 214, 0.34);
  color: #2563a9;
}

.datetime-day.is-selected {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.datetime-time-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.datetime-time-row span {
  color: var(--slate);
  font-weight: 800;
}

.datetime-time-row .datetime-time-input {
  width: 100%;
  height: 34px;
  min-height: 34px;
  padding: 6px 8px;
  text-align: center;
}

.datetime-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.datetime-link,
.datetime-confirm {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}

.datetime-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--slate);
}

.datetime-confirm {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

.page-image-retrieval .imei-timeline-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-height: 40px;
  min-width: 66px;
  padding: 0 16px;
  white-space: nowrap;
}

.image-retrieval-actions {
  display: inline-flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.page-image-retrieval .image-retrieval-cancel {
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.page-image-retrieval .image-retrieval-account-query {
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.page-image-retrieval .gap-banner.is-error {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.10) 0%, #fff 100%);
  border-color: rgba(239, 68, 68, 0.22);
  color: #991b1b;
}

.page-image-retrieval .gap-banner.is-ok {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, #fff 100%);
  border-color: rgba(16, 185, 129, 0.22);
  color: #047857;
}

.image-retrieval-result,
.image-retrieval-history,
.image-retrieval-fingerprint,
.image-retrieval-oss {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.image-retrieval-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.image-retrieval-section-head h2 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.image-retrieval-section-head span {
  font-size: 12px;
  color: var(--mist);
}

.image-retrieval-section-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.image-retrieval-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, auto) auto;
  gap: 14px;
  align-items: center;
}

.image-retrieval-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.image-retrieval-progress p {
  flex: 0 0 100%;
  margin: 2px 0 0;
  color: var(--slate);
  font-size: 13px;
}

.image-retrieval-step {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--mist);
  font-size: 12px;
  font-weight: 700;
}

.image-retrieval-step.is-active {
  border-color: rgba(232, 93, 74, 0.28);
  background: rgba(232, 93, 74, 0.10);
  color: var(--brand);
}

.image-retrieval-step.is-done {
  border-color: rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.10);
  color: #047857;
}

.image-retrieval-result-grid span,
.image-retrieval-history-row span {
  display: block;
  font-size: 12px;
  color: var(--mist);
}

.image-retrieval-result-grid code,
.image-retrieval-history-row code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.image-retrieval-result-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink);
}

.image-retrieval-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.image-retrieval-clear,
.image-retrieval-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--slate);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.image-retrieval-clear:hover,
.image-retrieval-delete:hover {
  border-color: rgba(239, 68, 68, 0.32);
  color: #b91c1c;
}

.image-retrieval-clear:disabled,
.image-retrieval-delete:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.image-retrieval-history-list {
  display: grid;
  gap: 10px;
}

.image-retrieval-fingerprint-list {
  display: grid;
  gap: 6px;
}

.image-retrieval-fingerprint-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.image-retrieval-fingerprint-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.image-retrieval-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.image-retrieval-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-retrieval-avatar span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--slate);
  font-size: 11px;
  font-weight: 900;
}

.image-retrieval-fingerprint-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.image-retrieval-fingerprint-main strong {
  color: var(--ink);
  font-size: 13px;
}

.image-retrieval-fingerprint-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-height: 28px;
}

.image-retrieval-fingerprint-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.image-retrieval-fingerprint-title img {
  display: block;
  flex: 0 0 auto;
  width: auto;
  max-width: min(280px, 100%);
  max-height: 34px;
  object-fit: contain;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 3px 5px;
}

.image-retrieval-fingerprint-nick {
  display: inline-block;
  max-width: min(260px, 45vw);
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong, #1f2937);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-retrieval-fingerprint-id {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.image-retrieval-fingerprint-id code {
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.2;
}

.image-retrieval-fingerprint-main span {
  color: var(--mist);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.image-retrieval-fingerprint-main code,
.image-retrieval-fingerprint-main pre {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.image-retrieval-fingerprint-main details {
  margin-top: 2px;
}

.image-retrieval-relation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.image-retrieval-relation-chips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(211, 222, 236, 0.9);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.image-retrieval-relation-chips em {
  color: var(--mist);
  font-style: normal;
  font-weight: 700;
}

.image-retrieval-fingerprint-fields {
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) repeat(4, minmax(110px, 1fr));
  gap: 6px;
}

.image-retrieval-fingerprint-fields div,
.image-retrieval-duplicate {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.image-retrieval-fingerprint-fields strong,
.image-retrieval-duplicate strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.image-retrieval-chat-type-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  font-size: 12px;
  color: var(--muted, #64748b);
}

.image-retrieval-chat-type-edit select {
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 12px;
  color: var(--ink);
}

.image-retrieval-chat-type-edit select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.image-retrieval-duplicate div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.image-retrieval-duplicate code {
  padding: 4px 6px;
  font-size: 11px;
}

.image-retrieval-fingerprint-main summary {
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.image-retrieval-fingerprint-main pre {
  max-height: 220px;
  overflow: auto;
}

.image-retrieval-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.image-retrieval-pager .fp-pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 只保留顶部一份分页条，并随页面滚动悬停在 sticky 页眉下方。
   top 比页眉高度(桌面 88px)略小，让分页栏顶部塞进页眉后面被盖住；
   再给内层 padding-top，把按钮压到页眉下方，中间这段不透明背景正好盖住
   页眉与分页栏之间那条会透出后面行的缝（半透明页眉 + 子像素导致）。 */
.image-retrieval-pager-slot.is-top {
  position: sticky;
  top: 84px;
  z-index: 20;
  background: var(--surface);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.image-retrieval-pager-slot.is-top .image-retrieval-pager {
  padding-top: 8px;
}

.image-retrieval-pager span {
  color: var(--slate);
  font-size: 13px;
  font-weight: 800;
}

.image-retrieval-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.image-retrieval-page-jump input {
  width: 64px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
  background: #fff;
}

/* 用户指纹序号徽标：10 条一批增量加载时，给用户明确的“加载到第几条”反馈 */
.image-retrieval-fingerprint-seq {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft, #eef2ff);
  color: var(--brand, #4f46e5);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.image-retrieval-duplicate-progress,
.image-retrieval-duplicate-summary,
.image-retrieval-nick-duplicate-group {
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.image-retrieval-duplicate-progress {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.image-retrieval-duplicate-progress strong,
.image-retrieval-duplicate-summary strong,
.image-retrieval-nick-duplicate-group header strong {
  color: var(--ink);
  font-size: 14px;
}

.image-retrieval-duplicate-progress span,
.image-retrieval-duplicate-summary span,
.image-retrieval-nick-duplicate-group header span {
  display: block;
  margin-top: 3px;
  color: var(--mist);
  font-size: 12px;
  font-weight: 700;
}

.image-retrieval-duplicate-summary .is-warning {
  color: #b45309;
}

.image-retrieval-duplicate-failures {
  margin-top: 8px;
}

.image-retrieval-duplicate-failures summary {
  color: #92400e;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.image-retrieval-duplicate-failures ul {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding-left: 18px;
  color: #92400e;
  font-size: 12px;
  line-height: 1.45;
}

.image-retrieval-duplicate-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.9);
}

.image-retrieval-duplicate-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 160ms ease;
}

.image-retrieval-duplicate-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
}

.image-retrieval-nick-duplicate-group {
  overflow: hidden;
  background: #fff;
}

.image-retrieval-nick-duplicate-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.image-retrieval-nick-duplicate-group header strong {
  overflow-wrap: anywhere;
}

.image-retrieval-duplicate-group-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.image-retrieval-duplicate-group-actions label,
.image-retrieval-delete-id-option,
.image-retrieval-duplicate-item-actions label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 800;
  color: var(--slate);
  white-space: nowrap;
}

.image-retrieval-duplicate-group-actions span {
  display: inline;
  margin-top: 0;
  color: var(--slate);
  font-size: 12px;
}

.image-retrieval-duplicate-group-actions input,
.image-retrieval-delete-id-option input,
.image-retrieval-duplicate-item-actions input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.image-retrieval-nick-duplicate-list {
  display: grid;
  gap: 10px;
  padding: 10px 14px;
}

.image-retrieval-nick-duplicate-item {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
}

.image-retrieval-nick-duplicate-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.image-retrieval-nick-duplicate-item .image-retrieval-fingerprint-row {
  padding-top: 0;
  border-top: 0;
}

.image-retrieval-duplicate-item-actions {
  display: inline-flex;
  justify-self: start;
  gap: 8px;
  flex-wrap: wrap;
}

.image-retrieval-delete-id-option {
  justify-self: start;
  padding: 4px 8px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  background: #fff;
}

.image-retrieval-duplicate-item-actions label {
  padding: 4px 8px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-sm);
  background: #fff;
}

.image-retrieval-history-row {
  display: grid;
  grid-template-columns: minmax(260px, 0.48fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.image-retrieval-history-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.image-retrieval-history-row strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.image-retrieval-history-row .history-download {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  cursor: pointer;
}

.image-retrieval-history-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.image-retrieval-empty {
  padding: 14px 0;
  color: var(--mist);
  font-size: 13px;
}

.imei-timeline-primary,
.imei-timeline-ghost {
  min-height: 38px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.imei-timeline-primary {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

.imei-timeline-primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.imei-timeline-ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
}

.imei-timeline-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 1fr));
  gap: 10px;
}

.imei-timeline-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  min-width: 0;
}

.imei-timeline-kpi span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 6px;
}

.imei-timeline-kpi strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
  word-break: break-word;
}

.imei-timeline-kpi-imei {
  grid-column: span 1;
}

.imei-summary-text {
  min-width: 0;
  word-break: break-word;
}

.imei-note-edit {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(232, 93, 74, 0.28);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.imei-note-edit:hover {
  border-color: rgba(232, 93, 74, 0.46);
  box-shadow: 0 2px 10px rgba(232, 93, 74, 0.12);
}

.imei-timeline-msg-ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(13, 159, 110, 0.18);
}

.imei-timeline-msg-error {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: rgba(232, 93, 74, 0.18);
}

.imei-date-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

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

.imei-date-head h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
}

.imei-date-head p {
  margin-top: 5px;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.5;
}

.imei-date-tip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid rgba(232, 93, 74, 0.28);
  box-shadow: 0 2px 10px rgba(232, 93, 74, 0.12);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 800;
}

.imei-calendar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.imei-calendar-month-nav,
.imei-calendar-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.imei-calendar-month-nav strong {
  min-width: 118px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ink);
}

.imei-calendar-month-nav button,
.imei-calendar-filter button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.imei-calendar-month-nav button {
  width: 30px;
  font-size: 18px;
  line-height: 1;
}

.imei-calendar-filter button {
  padding: 0 10px;
}

.imei-calendar-month-nav button:hover,
.imei-calendar-filter button:hover,
.imei-calendar-filter button.active {
  background: var(--surface);
  color: var(--brand-deep);
  box-shadow: var(--shadow-xs);
}

.imei-calendar-month-nav button:disabled {
  color: var(--mist);
  cursor: not-allowed;
  background: transparent;
  box-shadow: none;
}

.imei-calendar-weekdays,
.imei-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.imei-calendar-weekdays {
  gap: 8px;
  padding: 2px 2px 8px;
  color: var(--mist);
  font-size: 12px;
  font-weight: 800;
}

.imei-calendar-weekdays span {
  text-align: center;
}

.imei-calendar-grid {
  gap: 8px;
}

.imei-calendar-grid-filtered {
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
}

.imei-calendar-blank {
  min-height: 104px;
}

.imei-calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 104px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  font-family: inherit;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease), transform 140ms var(--ease);
}

.imei-calendar-day.has-task {
  cursor: pointer;
  background: linear-gradient(180deg, #f0f9ff 0%, #dff3ff 100%);
  border-color: rgba(14, 116, 144, 0.46);
  box-shadow: 0 6px 18px rgba(14, 116, 144, 0.1);
}

.imei-calendar-day.has-task:hover {
  border-color: #0e7490;
  box-shadow: 0 10px 24px rgba(14, 116, 144, 0.15);
  transform: translateY(-1px);
}

.imei-calendar-day.no-task {
  cursor: default;
}

.imei-calendar-day.is-selected {
  background: #e0f2fe;
  border-color: #0e7490;
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.14);
}

.imei-calendar-day .day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.imei-calendar-day .day-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink);
}

.imei-calendar-day .day-num.is-today-label {
  font-size: 16px;
  color: #0369a1;
}

.imei-calendar-day .day-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.imei-calendar-day[data-sync-status="synced"] {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.imei-calendar-day[data-sync-status="missing"] {
  background: #f8fafc;
  border-color: #cbd5e1;
  border-style: dashed;
}

.imei-calendar-day[data-sync-status="partial"] {
  background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
  border-color: #fde68a;
}

.imei-calendar-day[data-sync-status="today-partial"] {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.imei-calendar-day[data-sync-status="failed"] {
  background: linear-gradient(180deg, #fff 0%, #fff1f2 100%);
  border-color: #fecdd3;
}

.imei-calendar-day[data-sync-status="running"] {
  background: linear-gradient(180deg, #fff 0%, #eff6ff 100%);
  border-color: #bfdbfe;
}

.imei-calendar-day.has-task[data-sync-status] {
  background: linear-gradient(180deg, #f0f9ff 0%, #dff3ff 100%);
  border-color: rgba(14, 116, 144, 0.46);
  border-style: solid;
}

.imei-calendar-day[data-sync-status="synced"] .day-status,
.imei-calendar-legend .synced::before { background: #22c55e; }
.imei-calendar-day[data-sync-status="missing"] .day-status,
.imei-calendar-legend .missing::before { background: #94a3b8; }
.imei-calendar-day[data-sync-status="partial"] .day-status { background: #d97706; }
.imei-calendar-day[data-sync-status="today-partial"] .day-status,
.imei-calendar-legend .today-partial::before { background: #2563eb; }
.imei-calendar-day[data-sync-status="failed"] .day-status,
.imei-calendar-legend .failed::before { background: #dc2626; }
.imei-calendar-day[data-sync-status="running"] .day-status {
  background: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}
.imei-calendar-day.has-task[data-sync-status] .day-status,
.imei-calendar-legend .has-task::before {
  background: #0e7490;
  box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.14);
}

.imei-calendar-day .day-main {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3px;
  min-height: 44px;
}

.imei-calendar-day .day-main strong {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
}

.imei-calendar-day .day-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imei-calendar-day .day-meta {
  font-size: 12px;
  color: var(--slate);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imei-calendar-loading {
  min-height: 248px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
}

.imei-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
}

.imei-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.imei-calendar-legend span::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.imei-day-timeline {
  min-height: 80px;
  scroll-margin-top: 88px;
}

.imei-day-loading {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  min-height: 520px;
}

.imei-day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

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

.imei-day-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
}

.imei-day-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
}

.imei-day-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.imei-day-stats .ok {
  color: var(--success);
  border-color: rgba(13, 159, 110, 0.18);
}

.imei-day-stats .fail {
  color: var(--brand-deep);
  border-color: rgba(232, 93, 74, 0.2);
}

.imei-task-list {
  display: grid;
}

.imei-task {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  scroll-margin-top: 88px;
}

.imei-task:last-child {
  border-bottom: 0;
}

.imei-task.is-fail {
  background: #fff8f6;
}

.imei-task-time {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  white-space: nowrap;
  padding-top: 2px;
}

.imei-task-main {
  min-width: 0;
}

.imei-task-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 8px;
}

.imei-task-title strong {
  color: var(--ink);
  font-size: 14px;
}

.imei-task-title span {
  color: var(--ink-muted);
  font-size: 13px;
  word-break: break-word;
}

/* servers 标签：标识该任务来自哪个 servers（release / 其他环境） */
.imei-task-title span.imei-task-servers {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 18px;
  font-weight: 600;
  color: var(--slate);
  background: var(--surface-muted, #eef1f5);
  border: 1px solid var(--border, #d8dee6);
  white-space: nowrap;
}

.imei-task-title span.imei-task-servers.servers-release {
  color: #0a7d3c;
  background: #e6f6ec;
  border-color: #b6e3c6;
}

.imei-task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--slate);
  font-size: 12px;
}

.imei-task-meta > span,
.imei-task-meta code {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--slate);
  border: 1px solid transparent;
}

.imei-task-meta code {
  max-width: 100%;
  border-radius: 6px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  word-break: break-all;
  white-space: normal;
}

.imei-status.ok {
  background: var(--success-soft);
  color: var(--success);
}

.imei-status.fail {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.imei-status.other {
  background: var(--line-soft);
  color: var(--ink-muted);
}

.imei-task-reason {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(232, 93, 74, 0.15);
  color: var(--brand-deep);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.imei-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 20, 25, 0.45);
}

.imei-modal {
  width: min(720px, calc(100vw - 48px));
  min-height: min(360px, calc(100dvh - 48px));
  max-height: min(720px, calc(100dvh - 48px));
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.imei-modal-head h2 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
}

.imei-modal-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--slate);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.imei-history-list {
  padding: 12px;
  overflow: auto;
  min-height: 240px;
}

.imei-history-group + .imei-history-group {
  margin-top: 14px;
}

.imei-history-group-head {
  position: sticky;
  top: -12px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 8px;
}

.imei-history-group-head strong {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--ink);
}

.imei-history-group-head span {
  font-size: 12px;
  font-weight: 800;
  color: var(--slate);
}

.imei-history-item {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 8px;
}

.imei-history-item:hover {
  border-color: rgba(232, 93, 74, 0.28);
  background: var(--brand-soft);
}

.imei-history-main {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  word-break: break-word;
}

.imei-history-meta {
  font-size: 12px;
  color: var(--slate);
}

@media (max-width: 1280px) {
  .image-retrieval-search {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
    grid-template-areas:
      "image-mode image-mode"
      "image-imei image-imei"
      "image-range image-range"
      "image-start image-end"
      "image-action image-action";
  }

  .image-retrieval-search.is-fingerprint {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
    grid-template-areas:
      "image-mode image-mode"
      "image-imei image-imei"
      "image-account-type image-work"
      "image-nick image-page-size"
      "image-action image-action";
  }

  .image-retrieval-search.is-oss {
    grid-template-columns: minmax(220px, 1fr) minmax(140px, auto);
    grid-template-areas:
      "image-mode image-mode"
      "image-oss-key image-action";
  }

  .image-retrieval-search.is-fingerprint .image-retrieval-page-size {
    max-width: 120px;
  }

  .image-retrieval-search.is-fingerprint .image-retrieval-actions {
    align-self: end;
    grid-area: image-action;
  }

  .image-retrieval-actions {
    justify-self: end;
  }
}

@media (max-width: 900px) {
  .imei-timeline-search,
  .imei-timeline-summary {
    grid-template-columns: 1fr;
  }

  .image-retrieval-search {
    grid-template-areas:
      "image-mode"
      "image-imei"
      "image-oss-key"
      "image-account-type"
      "image-work"
      "image-nick"
      "image-page-size"
      "image-range"
      "image-start"
      "image-end"
      "image-action";
  }

  .image-retrieval-search.is-fingerprint {
    grid-template-columns: 1fr;
    grid-template-areas:
      "image-mode"
      "image-imei"
      "image-account-type"
      "image-work"
      "image-nick"
      "image-page-size"
      "image-action";
  }

  .image-retrieval-search.is-oss {
    grid-template-columns: 1fr;
    grid-template-areas:
      "image-mode"
      "image-oss-key"
      "image-action";
  }

  .image-retrieval-actions {
    justify-self: stretch;
    width: 100%;
  }

  .image-retrieval-actions .imei-timeline-primary,
  .image-retrieval-actions .imei-timeline-ghost,
  .image-retrieval-actions .image-retrieval-clear {
    flex: 1 1 0;
  }

  .image-retrieval-result-grid,
  .image-retrieval-history-row {
    grid-template-columns: 1fr;
  }

  .image-retrieval-duplicate-summary,
  .image-retrieval-nick-duplicate-group header {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-retrieval-duplicate-group-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .image-retrieval-fingerprint-fields {
    grid-template-columns: 1fr;
  }

  .image-retrieval-mode,
  .image-retrieval-pager,
  .image-retrieval-section-actions,
  .image-retrieval-pager .fp-pager-controls {
    width: 100%;
  }

  .image-retrieval-mode-row {
    width: 100%;
  }

  .image-retrieval-mode {
    flex: 1 1 auto;
    width: auto;
  }

  .image-retrieval-mode button,
  .image-retrieval-section-actions button,
  .image-retrieval-pager .fp-prev,
  .image-retrieval-pager .fp-next {
    flex: 1 1 0;
  }

  .image-retrieval-mode button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    white-space: nowrap;
  }

  .image-retrieval-pager {
    justify-content: stretch;
  }

  /* ≤900px 页眉约 84px 高，悬停偏移同步减小 */
  .image-retrieval-pager-slot.is-top {
    top: 80px;
  }

  .image-retrieval-download {
    justify-self: stretch;
  }

  .datetime-picker {
    flex-wrap: wrap;
  }

  .image-retrieval-end .datetime-picker-panel,
  .datetime-picker-panel {
    position: static;
    flex: 0 0 100%;
    width: 100%;
    margin-top: 8px;
  }

  .imei-date-head {
    flex-direction: column;
  }

  .imei-calendar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .imei-calendar-weekdays,
  .imei-calendar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .imei-calendar-weekdays {
    display: none;
  }

  .imei-calendar-blank {
    display: none;
  }

  .imei-day-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .imei-day-stats {
    justify-content: flex-start;
  }

  .imei-task {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .imei-task-time {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  .image-retrieval-mode-row {
    gap: 6px;
  }

  .image-retrieval-mode button,
  .image-retrieval-cache-refresh {
    padding-right: 6px;
    padding-left: 6px;
    font-size: 11px;
  }

  .cache-refresh-label-full {
    display: none;
  }

  .cache-refresh-label-short {
    display: inline;
  }
}

@media (max-width: 640px) {
  /* ≤640px 页眉约 74px 高，悬停偏移再减小 */
  .image-retrieval-pager-slot.is-top {
    top: 70px;
  }

  .kdg-ai-assistant {
    right: 14px;
    bottom: 14px;
  }

  .kdg-ai-panel {
    right: -2px;
    bottom: 64px;
    width: calc(100vw - 24px);
    height: min(560px, calc(100vh - 96px));
  }

  .kdg-ai-form {
    grid-template-columns: 1fr;
  }

  .kdg-ai-input-row {
    grid-template-columns: 1fr;
  }

  .kdg-ai-actions {
    display: grid;
    grid-template-columns: 74px 1fr;
  }

  .kdg-ai-form button,
  .kdg-ai-form .kdg-ai-attach-btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .imei-calendar-actions,
  .imei-calendar-month-nav,
  .imei-calendar-filter {
    width: 100%;
  }

  .imei-calendar-month-nav {
    justify-content: space-between;
  }

  .imei-calendar-filter button {
    flex: 1;
  }

  .imei-calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .user-imei-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .user-imei-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .page-header-badge::before { animation: none; }
}
