/* ============ 大厂风格 UI ============ */
:root {
  --bg: #f7f8fa;
  --surface: rgba(20,24,42,.30);
  --border: rgba(255,255,255,.28);
  --border-strong: rgba(255,255,255,.35);
  --text: #ffffff;
  --text-2: #e6e8ef;
  --text-3: #c8ccd8;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef0ff;
  --green: #16a34a;
  --green-soft: #e7f7ee;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --amber: #d97706;
  --amber-soft: #fdf1e0;
  --violet: #7c3aed;
  --violet-soft: #f2ebff;
  --red: #dc2626;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow: 0 4px 16px rgba(16,24,40,.08);
  --radius: 14px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 背景壁纸（固定铺满，内容区半透明叠加保证可读性）
   如需更换壁纸：把 wallpaper.jpg 放到 public/ 目录，或将下面的 url() 换成
   一个可直接打开的图片地址（浏览器地址栏粘贴能直接看到图片本身，而非网页）。 */
body {
  background-image:
    linear-gradient(rgba(247,248,250,0), rgba(247,248,250,0)),
    url("https://pub-bc6dc5bd52c141569ce1f7da2fc4c5f5.r2.dev/%E3%80%90%E5%93%B2%E9%A3%8E%E5%A3%81%E7%BA%B8%E3%80%91AI-%E6%8A%A5%E7%BA%B8%E5%A5%B3%E5%AD%A9-%E7%BE%8E%E5%A5%B3.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}



.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: transparent;
  border-right: 1px solid rgba(255,255,255,.14);
  color: #eef0f6;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 11px;
  object-fit: cover; display: block;
  box-shadow: 0 6px 18px rgba(99,102,241,.45);
}
.brand-title { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { color: #7c8398; font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: #aab1c4; font-size: 14px; cursor: pointer;
  text-decoration: none; transition: .18s;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, #4f46e5, #6d28d9); color: #fff; box-shadow: 0 6px 18px rgba(79,70,229,.4); }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }

.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #aab1c4; }
.live .dot {
  width: 9px; height: 9px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.foot-note { font-size: 12px; color: #6b7285; margin-top: 8px; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; padding: 26px 34px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.crumb { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.clock { font-variant-numeric: tabular-nums; font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); background: rgba(255,255,255,.12); border: 1px solid var(--border); padding: 7px 12px; border-radius: 10px; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 16px;
  position: relative; overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat-card.accent-green::before { background: var(--green); }
.stat-card.accent-blue::before { background: var(--blue); }
.stat-card.accent-amber::before { background: var(--amber); }
.stat-card.accent-violet::before { background: var(--violet); }
.stat-top { display: flex; justify-content: space-between; align-items: center; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat-chip { font-size: 11px; color: var(--text-3); background: var(--bg); border: 1px solid var(--border); padding: 2px 8px; border-radius: 20px; }
.stat-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; margin: 8px 0 2px; }
.stat-foot { font-size: 12px; color: var(--text-3); }
.stat-foot b { color: var(--text-2); }

/* ---------- 面板 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h2 { font-size: 16px; font-weight: 700; }
.muted { color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
/* 同步记录里的明细文字（成功/去重/无效/失败）：用深色，避免白色看不清 */
.log-detail { color: #1a1f36; font-size: 13px; margin-top: 4px; }

/* 进度条 */
.progress-wrap { margin: 8px 0 12px; }
.progress-info { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.progress-bar { height: 10px; background: var(--bg); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, #4f46e5, #22c55e); border-radius: 20px; transition: width .5s ease; }

.badge-status { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.badge-status.on { background: var(--green-soft); color: var(--green); }
.badge-status.off { background: #f1f2f4; color: var(--text-2); }

/* ---------- 表单 ---------- */
textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 12px 14px; font-family: ui-monospace, Consolas, monospace;
  font-size: 13px; resize: vertical; background: #fbfcfd; color: #1a1f36;
  transition: .15s;
}
textarea::placeholder, input::placeholder { color: #9aa1b2; }
textarea:focus, input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.mode-card {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1.5px solid var(--border-strong); border-radius: 12px; padding: 14px;
  cursor: pointer; transition: .15s; background: var(--surface);
}
.mode-card:hover { border-color: #b9bfe8; }
.mode-card input { margin-top: 3px; accent-color: var(--primary); }
.mode-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mode-title { font-weight: 600; font-size: 14px; }
.mode-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
input[type="number"] { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; font-size: 14px; width: 140px; background: #fbfcfd; color: #1a1f36; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd2dc; border-radius: 20px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ---------- 按钮 ---------- */
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.btn {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .15s;
}
.btn:hover { background: #f4f5f7; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn.primary:hover { background: var(--primary-600); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.result { font-size: 13px; }
.result.ok { color: var(--green); }
.result.err { color: var(--red); }

/* ---------- 表格 ---------- */
.table-wrap { border: 1px solid rgba(0,0,0,.08); border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.92); }
table { width: 100%; border-collapse: collapse; font-size: 13px; color: #1a1f36; text-shadow: none; }
th, td { text-align: left; padding: 12px 16px; }
thead { background: #f1f3f6; }
th { color: #5a6474; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr { border-top: 1px solid #e8eaed; }
tbody tr:hover { background: #fafbfc; }
td { color: #1a1f36; }
td code { font-family: ui-monospace, Consolas, monospace; color: #1a1f36; background: #f1f3f6; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.ta-r { text-align: right; }
td.ta-r { text-align: right; }
.del { color: var(--red); border-color: #f3c9c9; background: #fff5f5; padding: 5px 12px; font-size: 12px; border-radius: 8px; border: 1px solid #f3c9c9; cursor: pointer; }
.del:hover { background: #fee; }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.free { background: var(--green-soft); color: var(--green); }
.badge.used { background: #e5e7eb; color: #1a1f36; }
.empty { color: var(--text-3); text-align: center; padding: 26px; }

/* ---------- 视图切换 ---------- */
.view.hidden { display: none; }

/* ---------- select ---------- */
select {
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; background: #fbfcfd; color: #1a1f36;
}
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field input[type="text"], .field input[type="password"] {
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; background: #fbfcfd; color: #1a1f36; width: 100%;
}

/* ---------- 站点状态徽章 ---------- */
.site-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.site-badge.on { background: var(--green-soft); color: var(--green); }
.site-badge.off { background: #e5e7eb; color: #1a1f36; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-card {
  background: rgba(20,24,42,.9); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; width: min(680px, 92vw);
  max-height: 88vh; overflow-y: auto;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}


/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f1222; color: #fff; padding: 12px 22px; border-radius: 12px;
  font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: .28s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #7f1d1d; }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .sidebar { width: 72px; }
  .brand-text, .nav-item span:not(.nav-ico), .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .main { padding: 20px 16px 40px; }
  .mode-cards { grid-template-columns: 1fr; }
}
