/* ==========================================================================
   随申办活动订阅 & 捡漏雷达 - 现代化设计系统 (Modern Glassmorphism UI)
   ========================================================================== */

:root {
  /* 字体族 */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;

  /* 基础色彩体系 (Light Mode) */
  --bg-app: #f8fafc;
  --bg-gradient-1: rgba(99, 102, 241, 0.06);
  --bg-gradient-2: rgba(59, 130, 246, 0.05);
  
  --bg-card: rgba(255, 255, 255, 0.82);
  --bg-card-solid: #ffffff;
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-badge: #f1f5f9;
  --bg-floating: rgba(255, 255, 255, 0.85);

  --border-subtle: rgba(226, 232, 240, 0.8);
  --border-color: #e2e8f0;
  --border-focus: #4f46e5;
  --border-card: rgba(255, 255, 255, 0.6);

  /* 文本颜色 */
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* 品牌与功能主色 (Indigo / Blue / Emerald) */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-active: #3730a3;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --primary-glow: rgba(79, 70, 229, 0.25);

  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --success-glow: rgba(16, 185, 129, 0.25);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --danger-glow: rgba(239, 68, 68, 0.25);

  --warning: #f59e0b;
  --warning-hover: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  --warning-glow: rgba(245, 158, 11, 0.25);

  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --purple-border: #ddd6fe;

  --cyan: #06b6d4;
  --cyan-light: #ecfeff;

  /* 阴影层级 */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 6px -1px rgba(0, 0, 0, 0.05), 0 1px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 20px -3px rgba(15, 23, 42, 0.07), 0 3px 8px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 36px -4px rgba(15, 23, 42, 0.1), 0 6px 16px -2px rgba(15, 23, 42, 0.05);
  --shadow-float: 0 20px 40px -6px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.06);

  /* 圆角 */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* 动效 */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

/* 深色模式体系 (Dark Mode - Apple/Vercel Aesthetic) */
body.dark-mode {
  --bg-app: #090d16;
  --bg-gradient-1: rgba(99, 102, 241, 0.1);
  --bg-gradient-2: rgba(14, 165, 233, 0.08);

  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-solid: #111827;
  --bg-card-hover: rgba(24, 34, 53, 0.85);
  --bg-input: #151d2e;
  --bg-input-focus: #1a243a;
  --bg-hover: #1f293d;
  --bg-badge: #1a2336;
  --bg-floating: rgba(17, 24, 39, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-color: #243048;
  --border-focus: #6366f1;
  --border-card: rgba(255, 255, 255, 0.08);

  --text-main: #f8fafc;
  --text-body: #cbd5e1;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-active: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.16);
  --primary-border: rgba(99, 102, 241, 0.35);
  --primary-glow: rgba(99, 102, 241, 0.4);

  --success: #10b981;
  --success-hover: #34d399;
  --success-light: rgba(16, 185, 129, 0.16);
  --success-border: rgba(16, 185, 129, 0.35);
  --success-glow: rgba(16, 185, 129, 0.4);

  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.16);
  --danger-border: rgba(239, 68, 68, 0.35);
  --danger-glow: rgba(239, 68, 68, 0.4);

  --warning: #fbbf24;
  --warning-hover: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.16);
  --warning-border: rgba(245, 158, 11, 0.35);
  --warning-glow: rgba(245, 158, 11, 0.4);

  --purple: #a78bfa;
  --purple-light: rgba(167, 139, 250, 0.16);
  --purple-border: rgba(167, 139, 250, 0.35);

  --cyan: #38bdf8;
  --cyan-light: rgba(56, 189, 248, 0.16);

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 8px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px -4px rgba(0, 0, 0, 0.65);
  --shadow-float: 0 20px 48px -6px rgba(0, 0, 0, 0.8);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--duration-normal) var(--ease-smooth), color var(--duration-normal) var(--ease-smooth);
  background-image: 
    radial-gradient(at 15% 15%, var(--bg-gradient-1) 0px, transparent 55%),
    radial-gradient(at 85% 85%, var(--bg-gradient-2) 0px, transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 6.5rem;
  flex: 1;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-spring);
}

.brand-logo:hover {
  transform: scale(1.05) rotate(3deg);
}

.brand-info h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 400;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.status-pill.running {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-pill.stopped {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.version-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.status-pill.running .pulse-dot::after {
  content: "";
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: pulse-ring 2s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.8); opacity: 0; }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  outline: none;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #2563eb 100%);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card-solid);
  color: var(--text-body);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-focus);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--success-glow);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--success-hover) 0%, #047857 100%);
  box-shadow: 0 4px 16px var(--success-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px var(--danger-glow);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--danger-hover) 0%, #b91c1c 100%);
  box-shadow: 0 4px 16px var(--danger-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-switch {
  position: relative;
  width: 44px;
  height: 26px;
  display: inline-block;
  cursor: pointer;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch .slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.theme-switch .slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
  border-radius: 50%;
  transition: transform var(--duration-normal) var(--ease-spring);
}

body.dark-mode .theme-switch .slider::after {
  background-color: #1e293b;
  transform: translateX(18px);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 960px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--duration-normal) var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-green { background: var(--success-light); color: var(--success); }
.icon-purple { background: var(--purple-light); color: var(--purple); }
.icon-orange { background: var(--warning-light); color: var(--warning); }

.metric-data {
  flex: 1;
  min-width: 0;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-val {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 下次巡检时间：日期/时间两行显示（metric-val 内由 JS 注入两个 span） */
.metric-val .next-run-date,
.metric-val .next-run-time {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-val .next-run-date {
  font-size: 0.9rem;
  color: var(--text-light);
}

.metric-val .next-run-time {
  font-size: 1.3rem;
  margin-top: 0.1rem;
}

.metric-hint {
  font-size: 0.74rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-grid {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.config-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal);
}

.config-card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.card-title svg {
  color: var(--primary);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.form-label-desc {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.95rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
}

input:focus,
select:focus {
  background-color: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder {
  color: var(--text-light);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.75rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  transition: color var(--duration-fast);
}

.password-toggle-btn:hover {
  color: var(--text-main);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px var(--primary-glow);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  min-width: 80px;
  text-align: center;
}

.town-preset-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: var(--bg-hover);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

.preset-select {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
}

.url-items-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.url-card-item {
  display: grid;
  grid-template-columns: 28px 140px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast) var(--ease-smooth);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.url-card-item:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.url-index-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-badge);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.url-remark-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.url-link-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 0.82rem !important;
}

.url-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .url-card-item {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    row-gap: 0.5rem;
  }
  .url-remark-input {
    grid-column: 2 / 3;
  }
  .url-item-actions {
    grid-column: 3 / 4;
  }
  .url-link-input {
    grid-column: 1 / 4;
    width: 100%;
  }
}

.radar-box {
  background: linear-gradient(145deg, var(--bg-hover) 0%, var(--bg-card-solid) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.radar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.radar-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.radar-toggle-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.tags-container {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  color: var(--text-body);
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.tag-badge:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  transform: translateY(-1px);
}

.bottom-actions {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(1080px, calc(100% - 2rem));
  background: var(--bg-floating);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  box-shadow: var(--shadow-float);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  z-index: 90;
  transition: all var(--duration-normal) var(--ease-spring);
}

.bottom-actions-left,
.bottom-actions-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-overlay,
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  animation: fadeIn var(--duration-fast) var(--ease-smooth);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, calc(100% - 2rem));
  max-height: 85vh;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  z-index: 101;
  overflow: hidden;
  animation: modalPop var(--duration-normal) var(--ease-spring);
}

@keyframes modalPop {
  from { transform: translate(-50%, -46%) scale(0.96); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.terminal-console {
  background: var(--bg-hover);
  color: var(--text-main);
  font-family: Consolas, Menlo, Monaco, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 1.25rem 1.5rem;
  margin: 0;
  overflow-y: auto;
  max-height: calc(85vh - 70px);
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 1px solid var(--border-color);
}

.drawer-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* 与配置页 .app-container 等宽（1140px），居中弹窗式 */
  width: min(1140px, calc(100% - 2rem));
  max-height: 85vh;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--bg-card-solid);
  box-shadow: var(--shadow-float);
  display: flex;
  flex-direction: column;
  z-index: 101;
  overflow: hidden;
  animation: modalPop var(--duration-normal) var(--ease-spring);
}

@keyframes slideLeft {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.activity-feed-list {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-feed-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 0.85rem;
  transition: transform var(--duration-fast);
}

.activity-feed-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
}

.activity-img-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

.activity-meta-wrap {
  flex: 1;
  min-width: 0;
}

.activity-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.activity-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.badge-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--bg-floating);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  animation: toastIn var(--duration-normal) var(--ease-spring);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-message.success { border-left: 4px solid var(--success); color: var(--success); }
.toast-message.error { border-left: 4px solid var(--danger); color: var(--danger); }
.toast-message.info { border-left: 4px solid var(--primary); color: var(--primary); }

.flashes {
  list-style: none;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
}

.flash-item.error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.flash-item.success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-float);
  text-align: center;
  animation: modalPop var(--duration-normal) var(--ease-spring);
}

.auth-logo {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px var(--primary-glow);
  margin-bottom: 1.25rem;
}

.auth-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.auth-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

/* 日志语法高亮 */
.log-line-error { color: #f87171; font-weight: 600; }
.log-line-warn { color: #fbbf24; }
.log-line-info { color: #38bdf8; }
.log-line-debug { color: #94a3b8; }

/* 活动流街镇分类切换标签栏 */
.activity-feed-tabs-bar {
  background: var(--bg-hover);
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow: hidden;
}

.activity-feed-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 2px 0;
}

.activity-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-solid);
  color: var(--text-body);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  user-select: none;
  flex-shrink: 0;
}

.activity-tab-btn:hover {
  color: var(--primary);
  border-color: var(--primary-border);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.activity-tab-btn.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px var(--primary-glow);
  transform: translateY(-1px);
}

.activity-tab-badge {
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 600;
  transition: all var(--duration-fast);
}

.activity-tab-btn.active .activity-tab-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.activity-tab-btn:hover:not(.active) .activity-tab-badge {
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
}

body.dark-mode .activity-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .activity-tab-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

body.dark-mode .activity-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

body.dark-mode .activity-tab-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* 活动卡片所属街镇小标签 */
.activity-feed-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1;
  min-width: 0;
}

.activity-feed-town-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.48rem;
  border-radius: var(--radius-xs);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

body.dark-mode .activity-feed-town-tag {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

/* 活动流抽屉卡片 */
.activity-feed-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.activity-feed-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* 活动流卡片报名行：默认为灰色标准色；系统时间距离活动开始 48 小时 ~ 活动结束前标记为黄底红色；再无其它标色方案 */
.feed-registration {
  color: var(--text-muted);
  display: inline-block;
  width: fit-content;
  transition: all var(--duration-fast);
}

.feed-registration-highlight {
  color: #dc2626 !important;
  background: #fef08a !important;
  border: 1px solid rgba(234, 179, 8, 0.5) !important;
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.45rem;
  font-weight: 700;
}

body.dark-mode .feed-registration-highlight {
  color: #f87171 !important;
  background: rgba(234, 179, 8, 0.25) !important;
  border-color: rgba(234, 179, 8, 0.45) !important;
}

/* 活动标题（悬浮查看详情的触发点） */
.activity-feed-title {
  cursor: help;
  text-decoration: underline dotted rgba(148, 163, 184, 0.6);
  text-underline-offset: 3px;
}

/* 已过期的活动卡片（报名截止时间与活动开始时间均早于当前系统时间） */
.activity-feed-card.is-expired {
  opacity: 0.55;
  filter: grayscale(1);
  transition: opacity var(--duration-fast), transform var(--duration-fast);
}

.activity-feed-card.is-expired:hover {
  opacity: 0.85;
}

.activity-feed-card.is-expired,
.activity-feed-card.is-expired * {
  color: var(--text-muted) !important;
}

.activity-feed-card.is-expired .status-pill {
  color: var(--text-muted) !important;
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

.activity-feed-card.is-expired .feed-registration,
.activity-feed-card.is-expired .feed-registration-highlight {
  color: var(--text-muted) !important;
  background: transparent !important;
  border-color: transparent !important;
  padding: 0 !important;
  font-weight: normal !important;
}

.activity-feed-card.is-expired[style*="border-left"] {
  border-left-color: var(--border-color) !important;
}

/* 活动详情弹窗（点击活动名打开，粘性显示） */
.detail-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 102;
  width: min(640px, calc(100% - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  padding: 1rem 1.25rem;
  font-size: 0.84rem;
  line-height: 1.7;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  animation: modalPop var(--duration-fast) var(--ease-smooth);
}

.detail-popover .detail-popover-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  padding-right: 2.2rem;
}

.detail-popover .detail-popover-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 1.8rem;
  height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.detail-popover .detail-popover-close:hover {
  background: var(--bg-hover);
  color: var(--danger);
}

.detail-popover .detail-popover-loading {
  color: var(--text-muted);
  font-style: italic;
}

/* 详情文本中的类目名（地点：/时间：/联系电话：/活动介绍：等）加粗 */
.detail-popover-text .detail-label {
  font-weight: 700;
  color: var(--text-main);
}

/* 报名时间距现在不足一周：整行红色加粗高亮 */
.detail-popover-text .detail-line-urgent {
  font-weight: 700;
  color: #ef4444;
}

.detail-popover-text .detail-line-urgent .detail-label {
  color: #ef4444;
}

/* 详情弹窗图片区（封面/头图/正文内嵌图，纵向排列） */
.detail-popover-images {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.65rem 0;
}

.detail-popover-images a {
  display: block;
  line-height: 0;
}

.detail-popover-images img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: filter var(--duration-fast);
  cursor: zoom-in;
}

.detail-popover-images img:hover {
  filter: brightness(1.06);
}


/* ==========================================================================
   移动端适配（≤720px）：在尽量不改动 PC 效果的前提下优化小屏排版
   - 顶部 Header 纵向堆叠、标题换行、操作按钮收纳为紧凑布局
   - 指标卡、表单网格、URL 卡片、滑块、底栏全面转为单列/满宽
   - 弹窗与抽屉全屏化，避免横向溢出
   ========================================================================== */
@media (max-width: 720px) {
  /* 页面容器：收窄留白 */
  .app-container {
    padding: 1rem 0.85rem 7rem;
  }

  /* 开关滑块：防止被 flex/grid 纵向拉伸成椭圆，锁定原始尺寸与圆形滑块 */
  .toggle-switch {
    width: 44px;
    height: 24px;
    flex: 0 0 44px;
    align-self: flex-start;
  }
  .toggle-slider {
    width: 44px;
    height: 24px;
  }
  .toggle-slider::before {
    width: 18px;
    height: 18px;
  }
  .toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
  }

  /* 街镇预设下拉框：恢复单行原生高度，禁止被拉伸 */
  .preset-select {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    line-height: 1.4;
  }

  /* 顶部 Header：品牌区与操作区纵向堆叠 */
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }
  .brand-section {
    width: 100%;
  }
  .brand-info h1 {
    font-size: 1.05rem;
    flex-wrap: wrap;
    gap: 0.4rem;
    word-break: break-all;
  }
  .brand-subtitle {
    font-size: 0.74rem;
    line-height: 1.45;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .header-actions .btn span {
    font-size: 0.8rem;
  }

  /* 指标卡：单列满宽，数值不截断 */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .metric-card {
    padding: 0.85rem 1rem;
  }
  .metric-val {
    font-size: 1rem;
    white-space: normal;
    word-break: break-all;
  }

  /* 主配置网格：卡片单列 */
  .main-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .config-card {
    padding: 1rem;
  }
  .card-title {
    font-size: 0.95rem;
  }
  .card-desc {
    font-size: 0.78rem;
  }

  /* 街镇预设工具栏：纵向排列 */
  .town-preset-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .town-preset-bar .btn {
    width: 100%;
    justify-content: center;
  }

  /* 表单：所有 grid 分组单列化、输入框满宽；select 单独控制避免被拉伸 */
  .config-card div[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 0.9rem !important;
  }
  input[type="text"],
  input[type="url"],
  input[type="password"],
  input[type="number"],
  input[type="time"],
  select {
    width: 100%;
    min-width: 0;
    font-size: 16px; /* ≥16px 防 iOS 聚焦自动放大 */
  }
  /* select 不继承通用满宽拉伸：保持原生单行高度（align-self 防网格纵向拉伸） */
  select {
    align-self: start;
    height: auto;
    min-height: 0;
    max-height: none;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
  .form-group {
    margin-bottom: 0.9rem;
  }

  /* 滑块行：上下堆叠，避免挤压 */
  .slider-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .slider-val-badge {
    align-self: flex-end;
  }

  /* 雷达/开关盒：标题与说明纵向 */
  .radar-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .radar-toggle-title {
    font-size: 0.85rem;
  }
  /* 开关标签行：图标+开关+文字横排不被压缩，文字允许换行占满剩余宽度 */
  .radar-toggle-label {
    display: flex;
    align-items: center;
    width: 100%;
  }
  .radar-toggle-label .toggle-switch {
    flex: 0 0 44px;
  }
  .radar-toggle-label .radar-toggle-title {
    flex: 1;
    min-width: 0;
  }

  /* 关键词/代理标签组：允许换行满宽 */
  .tags-container {
    display: flex !important;
    flex-wrap: wrap;
    width: 100%;
  }

  /* 底部悬浮操作栏：压缩为紧凑两行布局 */
  .bottom-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    bottom: 0.75rem;
    width: calc(100% - 1.5rem);
  }
  .bottom-actions-left,
  .bottom-actions-right {
    width: 100%;
  }
  .bottom-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  /* 弹窗与抽屉：全屏化 */
  .modal-window {
    width: calc(100% - 1rem);
    max-height: 92vh;
  }
  .modal-header {
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .modal-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .drawer-content {
    width: calc(100% - 1rem);
    max-height: 92vh;
  }
  .detail-popover {
    width: calc(100% - 1rem);
    max-height: 80vh;
  }
  .terminal-console {
    font-size: 11px;
    padding: 0.75rem 0.85rem;
  }

  /* 活动流卡片：时间行允许换行 */
  .activity-feed-card {
    flex-direction: column;
  }
  .feed-date-row {
    gap: 0.5rem;
  }
}
