/* ==========================================================================
   Scrape · 视觉体系沿用 Sonarr：悬浮胶囊导航 + 卡片墙 + 点阵背景
   ========================================================================== */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-subtle: #f1f5f9;
  --panel-hover: #e2e8f0;
  --line: #e2e8f0;
  --line-soft: #edf2f7;

  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --brand: #0f172a;
  --brand-accent: #6366f1;
  --brand-soft: #e0e7ff;
  --brand-border: #c7d2fe;

  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --danger-line: #fecaca;
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --ok: #10b981;
  --ok-soft: #d1fae5;
  --ok-line: #a7f3d0;

  --radius-pill: 9999px;
  --radius-lg: 16px;
  --radius: 10px;
  --radius-sm: 6px;

  --shadow-capsule: 0 10px 30px -8px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.02), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
  --shadow-hover: 0 12px 28px -6px rgba(15, 23, 42, 0.09);

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --content-w: min(1360px, calc(100vw - 40px));
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  background-color: var(--bg);
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  min-height: 32px;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
button:hover { background: var(--panel-subtle); border-color: #cbd5e1; transform: translateY(-0.5px); }
button:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button.primary {
  background: #0f172a; border-color: #0f172a; color: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}
button.primary:hover { background: #1e293b; border-color: #1e293b; box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--panel-subtle); color: var(--text); }
button.danger { background: #fff; border-color: var(--danger-line); color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.tiny { min-height: 26px; padding: 3px 9px; font-size: 12px; }

input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  min-height: 36px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: all 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 12px 0 5px; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.good { color: var(--ok); font-weight: 600; }
.bad { color: var(--danger); font-weight: 600; }
.mono { font-family: var(--font-mono); }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---- 登录 / 初始化 ---- */
#login-screen, #setup-screen {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 380px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-capsule);
  padding: 30px 28px;
}
.login-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.login-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 26%;
  background: #0f172a; color: #fff; font-size: 15px; font-weight: 800;
}
.login-version { font-size: 11px; color: var(--muted-light); font-family: var(--font-mono); }
.login-tip { font-size: 12px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; min-height: 28px; padding: 4px 8px; color: var(--muted);
}
.password-toggle:hover { background: transparent; color: var(--text); transform: translateY(-50%); }
.password-toggle svg { width: 16px; height: 16px; }
.login-error {
  margin-top: 12px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); border: 1px solid var(--danger-line);
  color: #b91c1c; font-size: 12px;
}

/* ---- 悬浮胶囊导航 ---- */
#app { display: block; padding-top: 84px; }

.topbar {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  width: var(--content-w); height: auto; min-height: 54px; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-capsule);
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 16px;
  justify-content: space-between;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -0.02em; flex: 0 0 auto; }
.topbar-brand .brand-mark { width: 24px; height: 24px; font-size: 13px; border-radius: 26%; display: inline-flex; align-items: center; justify-content: center; }
.topbar-brand .ver { font-size: 10.5px; color: var(--muted-light); font-family: var(--font-mono); font-weight: 500; }

.topbar-nav {
  display: flex; align-items: center; gap: 4px;
  background: rgba(241, 245, 249, 0.6);
  padding: 3px; border-radius: var(--radius-pill);
  border: 1px solid rgba(226, 232, 240, 0.6);
  overflow-x: auto; scrollbar-width: none; justify-content: center;
  width: fit-content; min-width: 0; margin: 0 auto;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.topbar-nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; border-radius: var(--radius-pill);
  padding: 5px 12px; min-height: 32px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); box-shadow: none; white-space: nowrap;
}
.nav-item:last-child { margin-right: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.7); color: var(--text); transform: none; }
.nav-item.active {
  background: #fff; color: #0f172a; font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(0,0,0,0.04);
}
.nav-item svg { width: 14px; height: 14px; stroke-width: 2.2px; }
.nav-item.active svg { color: var(--brand-accent); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pill-badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: #fff; padding: 4px 11px; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.pill-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-light); }
.pill-badge.live { border-color: var(--ok-line); background: var(--ok-soft); color: #047857; }
.pill-badge.live .dot { background: var(--ok); animation: pulse 1.6s infinite; }
.pill-badge.warn { border-color: #fde68a; background: var(--warn-soft); color: #92400e; }
.pill-badge.warn .dot { background: var(--warn); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- 主内容 ---- */
.main { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 10px 12px 90px; }
.view { animation: fade 0.22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 {
  font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: #0f172a;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 8px 20px; box-shadow: var(--shadow-card);
}
.view-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-actions.crawl-inline { flex-wrap: nowrap; }
.view-actions.crawl-inline input { width: 280px; max-width: 30vw; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.card-grid { display: grid; gap: 14px; }
.card-grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card-grid.two .card,
.settings-grid .card { min-width: 0; }
.card-grid.two .card + .card,
.settings-grid .card + .card,
.logs-grid .card + .card { margin-top: 0; }
.card-grid.two { align-items: stretch; }
#view-home .card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
#view-home .card-grid.two .card {
  min-height: 310px; height: 310px; display: flex; flex-direction: column; overflow: hidden;
}
#view-home .card-grid.two .card > .table-scroll,
#view-home .card-grid.two .card > .card-scroll { flex: 1 1 auto; max-height: none; min-height: 0; }
.card-scroll { overflow-y: auto; max-height: 260px; min-height: 0; }
.table-scroll { overflow: auto; max-height: 260px; min-height: 0; }

/* 影片页维护工具：按钮和进度错开，不再让一长串状态占满一行 */
.movie-tools-head { align-items: flex-start; }
.movie-tools {
  display: grid; gap: 10px; flex: 1 1 auto; min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: #fff;
  box-shadow: var(--shadow-card);
}
.movie-tools .tool-row {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px; border: 1px solid var(--line-soft); border-radius: var(--radius);
  min-height: 58px; align-content: center;
}
.movie-tools .tool-label {
  display: inline-flex; flex: 0 0 auto; color: var(--muted);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  width: auto; min-width: 64px;
}
.movie-tools input { flex: 1 1 190px; min-width: 190px; max-width: 240px; min-height: 30px; padding: 4px 10px; }
.movie-tools button { min-height: 30px; padding: 4px 10px; }
.movie-tools .progress-text { flex: 1 1 100%; font-size: 11.5px; color: var(--muted); min-width: 100%; word-break: break-word; }
.movie-tools .tool-row:has(.progress-text) .progress-text { flex-basis: 100%; }
.movie-tools-head h2 { align-self: flex-start; }
#view-tasks .movie-tools.task-maintenance {
  margin: 24px 0 36px;
}

/* 女优抓取：输入在左侧、按钮紧靠右侧、同一水平线 */
.crawl-inline { display: flex; align-items: center; gap: 8px; }
.crawl-inline input { flex: 1 1 240px; min-width: 220px; max-width: 320px; }
.crawl-inline button { flex: 0 0 auto; }

/* 设置页桌面双列，手机单列 */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.settings-grid .card { height: auto; }
.settings-grid .card:only-child { grid-column: 1 / -1; }
.settings-grid .card + .card { margin-top: 0; }

/* 主页与任务页高度对齐，任务页长列表内部滚动 */
.home-cards .card { display: flex; flex-direction: column; min-height: 330px; }
#view-home .card-grid.two { margin-bottom: 24px; }
#view-tasks .task-grid { align-items: stretch; margin-bottom: 44px; }
.task-card { display: flex; flex-direction: column; min-width: 0; min-height: 420px; height: 420px; overflow: hidden; }
.task-card .card-head { flex: 0 0 auto; }
.task-scroll { flex: 1 1 auto; max-height: none; min-height: 0; overflow-y: auto; }
.history-scroll { max-height: 280px; overflow-y: auto; }
#view-tasks .card.history-card { margin-top: 0; }

/* 分页：右下角紧凑布局 */
.view { position: relative; }
.pager {
  display: flex; align-items: center; gap: 7px;
  margin-top: 18px; flex-wrap: nowrap; overflow-x: auto;
}
.pager > :first-child { margin-left: auto; }
.pager button,
.pager input { min-height: 30px; height: 30px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 12px; flex: 0 0 auto; }
.pager input.pager-jump {
  width: 66px; min-height: 30px; height: 30px; padding: 0 10px;
  border-radius: var(--radius-pill); font-size: 12px; flex: 0 0 auto; text-align: center;
}
.pager .info { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pager .ellipsis { color: var(--muted-light); font-size: 12px; }

/* ---- 统计卡 ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 15px 17px;
}
.stat .k { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--muted-light); margin-top: 2px; }
.stat.accent { border-color: var(--brand-border); background: linear-gradient(180deg, #fff, #f5f6ff); }

/* ---- 进度 ---- */
.progress-row { padding: 12px 0; border-bottom: 1px dashed var(--line-soft); }
.progress-row:last-child { border-bottom: 0; padding-bottom: 0; }
.progress-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.progress-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.bar { height: 7px; border-radius: var(--radius-pill); background: var(--panel-subtle); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-accent), #818cf8); border-radius: inherit; transition: width 0.4s ease; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-pill); padding: 2px 9px;
  font-size: 11px; font-weight: 700; border: 1px solid var(--line);
  background: var(--panel-subtle); color: var(--text-secondary);
}
.tag.sub { background: var(--brand-soft); border-color: var(--brand-border); color: #4338ca; }
.tag.uhd { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.tag.ok { background: var(--ok-soft); border-color: var(--ok-line); color: #047857; }
.tag.bad { background: var(--danger-soft); border-color: var(--danger-line); color: #b91c1c; }
.tag.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.tag.run { background: var(--brand-soft); border-color: var(--brand-border); color: #4338ca; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }

/* ---- 女优卡片 ---- */
.actor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px; }
.actor-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden; cursor: pointer;
  transition: all 0.18s ease; text-align: center;
}
.actor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand-border); }
.actor-thumb { width: 100%; aspect-ratio: 1 / 1; background: var(--panel-subtle); position: relative; }
.actor-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.actor-thumb .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: var(--muted-light);
}
.actor-body { padding: 9px 8px 11px; }
.actor-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actor-sub { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.actor-card .hot {
  position: absolute; top: 6px; left: 6px;
  background: rgba(15,23,42,0.82); color: #fff; border-radius: var(--radius-pill);
  padding: 1px 7px; font-size: 10.5px; font-weight: 700;
}

/* ---- 影片卡片 ---- */
.movie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.movie-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden; cursor: pointer; transition: all 0.18s ease;
  display: flex; flex-direction: column;
}
.movie-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--brand-border); }
.movie-cover { width: 100%; aspect-ratio: 16 / 11; background: var(--panel-subtle); position: relative; overflow: hidden; }
.movie-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.movie-cover .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted-light); font-size: 12px; font-family: var(--font-mono);
}
.movie-badges { position: absolute; top: 7px; right: 7px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.movie-badges .tag { backdrop-filter: blur(4px); }
.movie-body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.movie-code { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; color: var(--brand-accent); }
.movie-title {
  font-size: 12.5px; font-weight: 600; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.movie-meta { font-size: 11px; color: var(--muted); display: flex; gap: 9px; flex-wrap: wrap; margin-top: auto; font-variant-numeric: tabular-nums; }

/* ---- 过滤条 ---- */
.filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-pill);
  padding: 7px 10px 7px 14px; box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.filters input[type="text"], .filters select { min-height: 30px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 12.5px; }
.filters input[type="text"] { max-width: 240px; }
.filters select { width: auto; min-width: 110px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chk input { width: 14px; height: 14px; accent-color: var(--brand-accent); }

/* 工具条/过滤器让按钮不要挤成一条 */
.view-actions button { white-space: nowrap; }
.filters .spacer { flex: 1; min-width: 10px; }

/* ---- 日志 ---- */
#view-logs {
  display: flex; flex-direction: column;
  height: calc(100dvh - 154px); min-height: 0; overflow: hidden;
  margin-bottom: -90px;
}
.logs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
#view-logs .logs-grid { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.logs-grid .card { min-width: 0; margin-top: 0; }
.logs-card { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: hidden; }
.logs-card .card-head { flex: 0 0 auto; }
.logs-card .log-box,
.logs-card .audit-scroll { flex: 1 1 auto; min-height: 0; }
.logs-card .log-box { height: auto; }
.audit-scroll { overflow: auto; }
.log-box {
  background: #0f172a; color: #cbd5e1; border-radius: var(--radius);
  padding: 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.75;
  height: 100%; max-height: none; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.log-box .t { color: #64748b; margin-right: 8px; }
.log-box .warn { color: #fbbf24; }
.log-box .err { color: #f87171; }
.log-box .ok { color: #34d399; }

/* ---- 设置 ---- */
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.hint.warn { color: #92400e; font-weight: 600; }
.dsn-box {
  background: var(--panel-subtle); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 11px; font-family: var(--font-mono); font-size: 11.5px;
  word-break: break-all; color: var(--text-secondary); margin-top: 5px;
}
.notice {
  border-radius: var(--radius); padding: 10px 13px; font-size: 12.5px; line-height: 1.65;
  border: 1px solid var(--brand-border); background: var(--brand-soft); color: #3730a3; margin-bottom: 14px;
}
.notice.warn { border-color: #fde68a; background: var(--warn-soft); color: #92400e; }
.notice.bad { border-color: var(--danger-line); background: var(--danger-soft); color: #b91c1c; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--line-soft);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .lbl { font-size: 12.5px; font-weight: 600; }
.switch-row .desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.switch input { width: 16px; height: 16px; accent-color: var(--brand-accent); }

/* ---- 弹层 ---- */
.modal-mask {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(3px); padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: 0 24px 60px -12px rgba(15,23,42,0.35);
  width: 100%; max-width: 860px; max-height: 88vh; overflow-y: auto;
}
.modal-head {
  position: sticky; top: 0; background: #fff; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.modal-body { padding: 18px 20px 22px; }
.detail-top { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 18px; }
.detail-cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel-subtle); overflow: hidden; }
.detail-cover img { width: 100%; display: block; }
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; font-size: 12.5px; }
.kv .k { color: var(--muted); font-weight: 600; }
.stills { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; margin-top: 8px; }
.stills img { width: 100%; aspect-ratio: 16/11; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); cursor: zoom-in; background: var(--panel-subtle); }

.lightbox {
  position: fixed; inset: 0; z-index: 250; background: rgba(2, 6, 23, 0.92);
  display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }

/* ---- 轮播 ---- */
.carousel { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.carousel::-webkit-scrollbar { height: 6px; }
.carousel::-webkit-scrollbar-thumb { background: var(--panel-hover); border-radius: 3px; }
.carousel > * { flex: 0 0 190px; }

/* ---- 趋势条 ---- */
.trend { display: flex; align-items: flex-end; gap: 5px; height: 78px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trend .col i {
  width: 100%; background: linear-gradient(180deg, #818cf8, var(--brand-accent));
  border-radius: 4px 4px 0 0; min-height: 2px; display: block;
}
.trend .col span { font-size: 9.5px; color: var(--muted-light); font-family: var(--font-mono); }

/* ---- 提示条 ---- */
#toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; border-radius: var(--radius);
  padding: 10px 15px; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 10px 26px -6px rgba(15,23,42,0.4); max-width: 340px;
  animation: toastIn 0.2s ease;
}
.toast.bad { background: #b91c1c; }
.toast.ok { background: #047857; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: 0.5; }

/* ---- 移动端：底部悬浮 dock + 左上椭圆标题 + 右上圆形退出 ---- */
@media (max-width: 1024px) {
  :root { --content-w: calc(100vw - 20px); }
  #app { padding-top: calc(56px + env(safe-area-inset-top)); padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .topbar {
    height: 48px; padding: 0 10px; gap: 8px;
    top: max(8px, env(safe-area-inset-top)); justify-content: space-between;
    left: 0; right: 0; width: 100%; transform: none;
    background: transparent; border: none; box-shadow: none;
    backdrop-filter: none; border-radius: 0;
  }
  .topbar-brand {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 14px 4px 8px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.92); color: #0f172a; font-size: 15px; font-weight: 800;
    box-shadow: 0 4px 14px rgba(15,23,42,0.10); border: 1px solid rgba(226, 232, 240, 0.85); flex: 0 0 auto;
  }
  .topbar-brand .brand-mark {
  width: 26px; height: 26px; border-radius: 26%; font-size: 14px;
  background: #0f172a; color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
  .topbar-brand .brand-name { letter-spacing: -0.02em; }
  .topbar-brand .ver { display: none; }
  .topbar-nav {
    position: fixed; top: auto; left: 50%; bottom: max(8px, calc(env(safe-area-inset-bottom) + 4px));
    transform: translateX(-50%);
    width: auto; max-width: calc(100vw - 24px);
    display: flex; align-items: center; gap: 2px; flex-wrap: nowrap;
    padding: 4px 6px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.96); border: 1px solid rgba(203, 213, 225, 0.75);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16); overflow-x: auto; z-index: 120;
    height: auto; min-height: 46px; max-height: 56px; margin: 0;
  }
  .nav-item {
    width: 46px; height: 40px; padding: 0; margin: 0;
    justify-content: center; border-radius: 999px; color: #334155;
    -webkit-tap-highlight-color: transparent; outline: none;
  }
  .nav-item svg { width: 21px; height: 21px; }
  .nav-item.active { background: #eef2ff; color: #4338ca; }
  .nav-item.active svg { color: #4338ca; }
  .nav-label { display: none !important; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .card:only-child { grid-column: auto; }
  #view-home .card-grid.two { grid-template-columns: 1fr; }
  #view-home .card-grid.two .card,
  .task-card,
  .logs-card { height: auto; min-height: 260px; }
  .task-grid,
  .logs-grid { grid-template-columns: 1fr; }
  #view-logs { display: block; height: auto; min-height: 0; overflow: visible; margin-bottom: 0; }
  #view-logs .logs-grid { grid-template-rows: none; }
  .logs-card .log-box,
  .logs-card .audit-scroll { max-height: 62vh; }
  .movie-tools { grid-template-columns: 1fr; }
  .logs-grid .card + .card { margin-top: 0; }
  .topbar-right .pill-badge { display: none; }
  #btn-logout {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent; outline: none;
  }
  #btn-logout svg { width: 18px; height: 18px; }
  .topbar-right { margin-left: 0; }
  .detail-top { grid-template-columns: 1fr; }
  .view-head h2 { font-size: 18px; padding: 6px 15px; }
}
