:root {
  --primary: #f5ba31;
  --primary-hover: #e5ab25;
  --primary-light: #fff8e7;
  --primary-dark: #3b2a05;
  --bg-page: #f8f6f0;
  --bg-card: #ffffff;
  --text-main: #1f2329;
  --text-sub: #646a73;
  --text-muted: #8f959e;
  --border-color: #f0ede6;
  --border-focus: #f5ba31;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --tag-hidden-bg: #fff0f2;
  --tag-hidden-text: #e03153;
  --tag-normal-bg: #f2f4f8;
  --tag-normal-text: #4e5969;
  --tag-popcard-bg: #f4f0ff;
  --tag-popcard-text: #722ed1;
  --verified-bg: #e8ffea;
  --verified-text: #00b42a;
  --pending-bg: #fff7e8;
  --pending-text: #ff7d00;
  --mismatch-bg: #ffece8;
  --mismatch-text: #f53f3f;
  --unavail-bg: #f2f3f5;
  --unavail-text: #86909c;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 24px);
}

/* 页面主体容器 */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #fffaee 0%, #f7f5ed 220px, var(--bg-page) 100%);
  position: relative;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.02);
}

@media (min-width: 1024px) {
  .app-container {
    max-width: 860px;
  }
}

/* 顶部状态栏与标题 */
.header-bar {
  padding: 16px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border: 2px solid #fff;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  color: #1f2329;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  background: #fde8b3;
  color: #8c5b05;
  border-radius: var(--radius-full);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 1px;
}

.capsule-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-sub);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* 筛选面板卡片 */
.filter-card {
  margin: 0 16px 12px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
}

.toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
}

/* 搜索输入框 */
.input-row {
  margin-bottom: 12px;
  position: relative;
}

.search-input-box {
  display: flex;
  align-items: center;
  background: #f7f8fa;
  border-radius: var(--radius-md);
  border: 1px solid #ebedf0;
  padding: 0 12px;
  height: 44px;
  transition: all 0.2s;
}

.search-input-box:focus-within {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(245, 186, 49, 0.2);
}

.search-input-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text-main);
}

.search-input-box input::placeholder {
  color: var(--text-muted);
}

.clear-btn {
  background: #c9cdd4;
  color: #fff;
  border-radius: var(--radius-full);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  border: none;
  outline: none;
}

.clear-btn:hover {
  background: #86909c;
}

/* 筛选 Pills 药丸按钮组 */
.pills-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pills-group::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  flex: 1;
  min-width: 68px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: #f4f5f7;
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  padding: 0 10px;
}

.pill-btn.active {
  background: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(245, 186, 49, 0.35);
}

/* 时间筛选 Pills */
.time-pills {
  margin-bottom: 14px;
}

.time-pill-btn {
  height: 32px;
  font-size: 12px;
  padding: 0 12px;
  background: #f7f8fa;
  color: var(--text-sub);
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
}

.time-pill-btn.active {
  background: #fde8b3;
  color: #8c5b05;
  font-weight: 600;
  border-color: #f7c963;
}

/* 自定义时间输入展开区 */
.custom-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  background: #fafafc;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed #e5e6eb;
}

.custom-time-row input[type="datetime-local"] {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #e5e6eb;
  font-size: 12px;
  background: #fff;
  color: var(--text-main);
  outline: none;
}

/* 高级筛选抽屉切换 */
.advanced-filter-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.filter-select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #e5e6eb;
  background: #fafafc;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
}

/* 操作按钮组 */
.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.btn-primary {
  height: 44px;
  background: var(--primary);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 10px rgba(245, 186, 49, 0.35);
  transition: all 0.15s ease-in-out;
}

.btn-primary:active {
  transform: scale(0.98);
  background: var(--primary-hover);
}

.btn-secondary {
  height: 44px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid #e5e6eb;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease-in-out;
}

.btn-secondary.active {
  border-color: #00b42a;
  color: #00b42a;
  background: #f2fff4;
}

/* 脉冲红点/绿点 */
.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00b42a;
  display: inline-block;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 180, 42, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(0, 180, 42, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 180, 42, 0); }
}

.filter-clear-link {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0 0;
  display: block;
}

.filter-clear-link:hover {
  color: var(--text-sub);
}

/* 采集器与统计状态条 */
.status-bar-card {
  margin: 0 16px 10px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.stat-left {
  display: flex;
  flex-direction: column;
}

.stat-left .number {
  font-size: 20px;
  font-weight: 800;
  color: #1f2329;
  line-height: 1.1;
}

.stat-left .label {
  font-size: 11px;
  color: var(--text-muted);
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: #e5e6eb;
}

.stat-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-right .collector-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #00b42a;
}

.stat-right .collector-status.error {
  color: #f53f3f;
}

.stat-right .time-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 通知条 */
.notice-card {
  margin: 0 16px 12px;
  background: #fff8e8;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #8c5b05;
  border: 1px solid #fce3a6;
}

.notice-tag {
  background: var(--primary);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

/* 列表区域 */
.list-header {
  padding: 4px 20px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 20px;
}

/* 单条事件卡片 */
.event-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  position: relative;
}

.event-card:hover {
  border-color: #ffd87a;
  box-shadow: var(--shadow-md);
}

.event-card:active {
  transform: scale(0.99);
}

/* 用户头像与昵称 */
.card-user-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 58px;
  flex-shrink: 0;
}

.user-avatar-wrap {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: #f2f3f5;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.user-avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-nickname {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 58px;
}

/* 款式预览与名称 */
.card-item-col {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.item-thumb-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f7f8fa;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #f0ede6;
}

.item-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-placeholder-icon {
  font-size: 20px;
  color: #c9cdd4;
}

.item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2329;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-badge-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  flex-wrap: wrap;
}

/* 款式徽章 */
.pill-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}

.pill-badge.hidden {
  background: var(--tag-hidden-bg);
  color: var(--tag-hidden-text);
}

.pill-badge.normal {
  background: var(--tag-normal-bg);
  color: var(--tag-normal-text);
}

.pill-badge.popcard {
  background: var(--tag-popcard-bg);
  color: var(--tag-popcard-text);
}

/* 身份徽章 */
.state-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
}

.state-badge.verified {
  background: var(--verified-bg);
  color: var(--verified-text);
}

.state-badge.pending {
  background: var(--pending-bg);
  color: var(--pending-text);
}

.state-badge.unavailable {
  background: var(--unavail-bg);
  color: var(--unavail-text);
}

.state-badge.mismatch {
  background: var(--mismatch-bg);
  color: var(--mismatch-text);
}

/* 右侧时间列 */
.card-time-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.time-str {
  font-size: 12px;
  font-family: monospace, -apple-system;
  color: var(--text-sub);
  font-weight: 500;
}

.time-rel {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 空状态与加载中 */
.empty-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px solid var(--border-color);
  margin-top: 10px;
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

/* 分页栏 */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 16px 30px;
}

.page-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid #e5e6eb;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-main);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: var(--text-sub);
}

/* 详情弹窗 / 抽屉 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
  .modal-content {
    border-radius: 18px;
    transform: scale(0.95);
    transition: transform 0.2s ease;
  }
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .modal-overlay.open .modal-content {
    transform: scale(1);
  }
}

.modal-header {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close-btn {
  background: #f2f3f5;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
}

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

/* 详情键值对 */
.detail-grid {
  display: grid;
  grid-template-columns: 85px 1fr;
  row-gap: 10px;
  column-gap: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

.detail-value {
  color: var(--text-main);
  word-break: break-all;
}

/* JSON 浏览器 */
.json-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.copy-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: #f2f3f5;
  border: 1px solid #e5e6eb;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-sub);
}

.copy-btn:hover {
  background: var(--primary);
  color: var(--primary-dark);
}

.json-code {
  background: #272822;
  color: #f8f8f2;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-x: auto;
  max-height: 260px;
  white-space: pre-wrap;
}

/* Toast 提示 */
.toast-msg {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.9);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  z-index: 2000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.toast-msg.show {
  opacity: 1;
}
