/* ============================================================
   同步交互层（在 app.css 之后加载，只做增量，不改原视觉规范）
   原则：
   1) 不引入新的字体/阴影体系，全部复用 --glass / --edge / --shadow-*
   2) 横幅、toast、进度条都用「浅底 + 发丝边」，避免在浅色页面上压一块重色
   3) 冒号后统一一个空格，数字用 --font-num 保证等宽，倒计时不会跳动
   ============================================================ */

/* ---------- 顶栏同步状态 ---------- */
.topbar-right { gap: 10px; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--edge-2);
  background: var(--glass-3);
  font-size: 12px; font-weight: 600; color: var(--t3);
  cursor: pointer; white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.sync-pill:hover { background: #fff; border-color: rgba(30,58,138,.3); }
.sync-pill:active { transform: translateY(1px); }
.sync-pill:disabled { cursor: not-allowed; opacity: .72; }
.sync-pill:disabled:hover { background: var(--glass-3); border-color: var(--edge-2); }

.sync-pill i.ring {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--down); flex: none;
}
.sync-pill.is-running i.ring {
  background: transparent;
  border: 2px solid rgba(30,58,138,.22);
  border-top-color: var(--brand-700);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sync-pill .num { font-family: var(--font-num); letter-spacing: -.2px; }

/* 已完成待刷新：轻微呼吸，提示"可以点了"但不吵闹 */
.sync-pill.is-done {
  border-color: rgba(4,120,87,.42);
  background: var(--down-soft);
  color: var(--down);
}
.sync-pill.is-done i.ring { background: var(--down); animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.72); opacity: .55; } }

/* ---------- 完成横幅 ---------- */
.sync-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 18px; margin-bottom: var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid rgba(4,120,87,.28);
  background: linear-gradient(180deg, rgba(232,246,240,.95), rgba(232,246,240,.72));
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,.9);
  color: var(--t2); font-size: 13px;
}
.sync-banner.is-fail {
  border-color: rgba(185,28,28,.28);
  background: linear-gradient(180deg, rgba(254,242,242,.96), rgba(254,242,242,.72));
}
.sync-banner .sb-icon {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--down); color: #fff;
}
.sync-banner.is-fail .sb-icon { background: var(--warn); }
.sync-banner b { font-weight: 680; }
.sync-banner .sb-act { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 同步配置弹窗 ---------- */
.sync-modal { max-width: 520px; }

.sync-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-md);
  background: rgba(30,58,138,.055);
  border: 1px solid rgba(30,58,138,.12);
  font-size: 12.5px; line-height: 1.65; color: var(--t3);
}
.sync-note svg { flex: none; margin-top: 1px; color: var(--brand-700); }
.sync-note b { color: var(--brand-900); font-weight: 680; }

.win-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.win-opt {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding: 11px 12px; border-radius: var(--r-md);
  border: 1px solid var(--edge-2); background: var(--glass-3);
  cursor: pointer; transition: border-color .14s, background .14s, box-shadow .14s;
}
.win-opt:hover { border-color: rgba(30,58,138,.34); background: #fff; }
.win-opt input { position: absolute; opacity: 0; pointer-events: none; }
.win-opt .wo-t { font-size: 13px; font-weight: 650; color: var(--t1); }
.win-opt .wo-d { font-size: 11.5px; color: var(--t5); }
.win-opt[data-on="true"] {
  border-color: var(--brand-700);
  background: rgba(30,58,138,.06);
  box-shadow: inset 0 0 0 1px var(--brand-700);
}
.win-opt[data-on="true"] .wo-t { color: var(--brand-900); }

.win-opt .wo-badge {
  position: absolute; top: -7px; right: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 1px 6px; border-radius: 999px;
  background: var(--brand-900); color: #fff;
}

/* 预计耗时条 */
.est-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  border: 1px dashed var(--edge-2); background: rgba(255,255,255,.6);
  font-size: 12.5px; color: var(--t3);
}
.est-bar .eb-k { color: var(--t5); }
.est-bar .eb-v { font-family: var(--font-num); font-weight: 700; color: var(--t1); }
.est-bar .eb-v.warn { color: var(--gold-ink); }

/* ---------- 进度条 ---------- */
.pbar {
  position: relative; height: 6px; border-radius: 999px;
  background: rgba(15,23,42,.08); overflow: hidden;
}
.pbar > i {
  position: absolute; inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-700), #4F7BE8);
  transition: width .6s ease;
}
.pbar.is-indet > i {
  width: 34% !important;
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide { 0% { left: -34%; } 100% { left: 100%; } }

.progress-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; color: var(--t5); margin-bottom: 7px;
}
.progress-head b { color: var(--t1); font-size: 13px; font-weight: 660; }
.progress-head .num { font-family: var(--font-num); margin-left: auto; color: var(--t3); }

/* 日志窗口：等宽、行高紧、底部渐隐，避免"一坨黑框" */
.sync-log {
  margin-top: 10px;
  max-height: 148px; overflow: auto;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: #0F172A;
  font-family: var(--font-num); font-size: 11px; line-height: 1.62;
  color: #C7D2E4;
  scrollbar-width: thin;
}
.sync-log div { white-space: pre-wrap; word-break: break-all; }
.sync-log div:last-child { color: #fff; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; right: 22px; bottom: 22px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  max-width: 340px; padding: 11px 14px;
  border-radius: var(--r-md);
  background: rgba(15,23,42,.94); color: #fff;
  font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 18px 40px -18px rgba(15,23,42,.6);
  animation: toastIn .22s ease-out;
}
.toast.ok { background: #065F46; }
.toast.warn { background: #92400E; }
.toast.err { background: #991B1B; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- 空状态 ---------- */
.empty-state {
  padding: 64px 20px; text-align: center; color: var(--t5);
}
.empty-state .es-t { font-size: 15px; font-weight: 650; color: var(--t2); margin-bottom: 6px; }
.empty-state .es-d { font-size: 12.5px; }

/* ---------- 加载骨架（首次进来别白屏）---------- */
.skeleton-row {
  height: 62px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, rgba(15,23,42,.045) 25%, rgba(15,23,42,.075) 37%, rgba(15,23,42,.045) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin: 6px 0;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- 真实图片：加载失败时兜底成插画 ---------- */
.thumb img, .lcard-thumb img, .drawer-hero img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

@media (max-width: 700px) {
  .win-grid { grid-template-columns: repeat(2, 1fr); }
  .sync-modal { max-width: 100%; }
  .sync-banner { flex-wrap: wrap; }
  .sync-banner .sb-act { margin-left: 0; width: 100%; }
}

/* ---------- 移动端筛选栏：fgroup 原本 nowrap，窄屏会把「区县」挤出屏幕 ---------- */
@media (max-width: 639px) {
  .filters .filter-row { padding: 10px 12px; }
  .filters .fgroup { flex-wrap: wrap; width: 100%; gap: 6px 8px; }
  .filters .fgroup > .f-label { width: 100%; }
  .filters .fgroup > .select,
  .filters .fgroup > .input {
    flex: 1 1 calc(50% - 8px); min-width: 0; width: auto !important;
  }
  .filters .range { width: 100%; }
  .filters .range .input { flex: 1 1 auto; min-width: 0; }
  .filters .search { width: 100%; }
  .filters .search .input { width: 100%; }
  .filters .filter-row > .btn--ghost { margin-left: 0 !important; width: 100%; }
  .filters .chips { padding: 0 12px 10px; }

  /* 顶栏：只留品牌 + 同步胶囊 + 头像 */
  .topbar { padding: 0 14px; }
  .brand-sub { display: none; }
  .sync-pill { padding: 0 10px; font-size: 11.5px; }
  .sync-pill .num { font-size: 11px; }
  .avatar { width: 30px; height: 30px; font-size: 11px; }
}

@media (max-width: 479px) {
  .sync-pill { height: 28px; padding: 0 9px; }
  .topbar-right { gap: 7px; }
}
