:root {
  --bg: #0f1115;
  --bg-2: #161a21;
  --bg-3: #1d222b;
  --line: #2a313c;
  --text: #e8e6e1;
  --text-dim: #9aa3af;
  --gold: #C9A961;
  --gold-soft: #e3c989;
  --green: #4caf7d;
  --red: #d65a5a;
  --radius: 10px;
  --sidebar-w: 200px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1a1f29, #0b0d11);
}
.login-card {
  width: 360px; padding: 40px 32px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.brand { font-size: 30px; font-weight: 800; color: var(--gold); letter-spacing: 4px; }
.brand-sub { color: var(--text-dim); font-size: 12px; margin: 8px 0 28px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form input {
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: 8px; font-size: 14px; outline: none;
}
.login-form input:focus { border-color: var(--gold); }
.login-msg { color: var(--red); font-size: 12px; min-height: 16px; }

/* ---------------- 框架 ---------------- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 0;
}
.logo { color: var(--gold); font-weight: 800; font-size: 18px; letter-spacing: 2px; text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.nav { flex: 1; display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; }
.nav a {
  color: var(--text-dim); text-decoration: none; padding: 10px 14px;
  border-radius: 8px; font-size: 14px; transition: .15s;
}
.nav a:hover { background: var(--bg-3); color: var(--text); }
.nav a.active { background: linear-gradient(90deg, rgba(201,169,97,.18), transparent); color: var(--gold-soft); font-weight: 600; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--text-dim); }

.content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; flex: 0 0 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; }
.topbar-actions { display: flex; gap: 10px; }
.view { flex: 1; overflow-y: auto; padding: 28px; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px;
  cursor: pointer; font-weight: 600; transition: .15s;
}
.btn-gold { background: var(--gold); color: #1a1308; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: var(--gold); }
.btn-mini { background: transparent; color: var(--text-dim); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.btn-mini:hover { color: var(--text); }

/* ---------------- 卡片/网格 ---------------- */
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; transition: .15s;
}
.card:hover { border-color: var(--gold); }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .num { font-size: 28px; font-weight: 800; color: var(--gold); }
.stat .lbl { color: var(--text-dim); font-size: 12px; }

.section-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; color: var(--text); }
.muted { color: var(--text-dim); }
.empty { color: var(--text-dim); text-align: center; padding: 60px 0; }

/* ---------------- 缩略图 ---------------- */
.thumb { width: 100%; aspect-ratio: 9/16; object-fit: cover; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--line); }
.thumb-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumb-row img, .thumb-row video { width: 48px; height: 64px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); }
.golden-badge { color: var(--gold); font-size: 11px; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 920px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--text-dim); }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--text);
  padding: 10px 12px; border-radius: 8px; font-size: 14px; outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 80px; }

/* ---------------- 表格/任务 ---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.pending { background: rgba(154,163,175,.18); color: var(--text-dim); }
.pill.running { background: rgba(201,169,97,.18); color: var(--gold-soft); }
.pill.succeeded { background: rgba(76,175,125,.18); color: var(--green); }
.pill.failed { background: rgba(214,90,90,.18); color: var(--red); }
.pill.canceled { background: rgba(154,163,175,.12); color: var(--text-dim); }

.progress { height: 6px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--gold); transition: width .3s; }

.job-line { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.job-line .t { flex: 0 0 150px; }
.job-line .bar { flex: 1; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--gold); color: var(--text);
  padding: 12px 22px; border-radius: 10px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tag { font-size: 11px; color: var(--text-dim); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; }

/* ==================== 移动端适配 (≤768px) ==================== */
@media (max-width: 768px) {

  /* ---- 汉堡菜单按钮 ---- */
  .menu-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background: none; border: 1px solid var(--line);
    border-radius: 8px; color: var(--text-dim); font-size: 18px; cursor: pointer;
    transition: .15s; flex-shrink: 0;
  }
  .menu-toggle:hover { border-color: var(--gold); color: var(--gold); }

  /* ---- 侧栏：默认隐藏，点击展开为全屏覆盖 ---- */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    width: 260px !important;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.6); }

  /* 遮罩层（JS 动态插入） */
  .sidebar-overlay {
    position: fixed; inset: 0; z-index: 99;
    background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity .28s;
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  /* ---- 内容区：全宽 ---- */
  .content { width: 100%; }
  .topbar { padding: 0 16px; height: 52px; flex-shrink: 0; }
  .topbar h1 { font-size: 16px; }
  .view { padding: 16px 14px; }

  /* ---- 网格：自动缩减列数 ---- */
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid.cols-2 { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* ---- 统计卡片：紧凑横向 ---- */
  .stat { flex-direction: row; align-items: center; gap: 10px; }
  .stat .num { font-size: 22px; }
  .stat .lbl { font-size: 11px; }

  /* ---- 表单：单列 ---- */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* ---- 表格：横向滚动 ---- */
  table { font-size: 12px; display: block; overflow-x: auto; white-space: nowrap; }
  th, td { padding: 8px 10px; }

  /* ---- 任务行 ---- */
  .job-line { flex-wrap: wrap; gap: 8px; padding: 10px 0; }
  .job-line .t { flex: 0 0 auto; font-size: 12px; min-width: 70px; }

  /* ---- 登录框 ---- */
  .login-card { width: 90%; max-width: 340px; padding: 32px 24px; }
  .brand { font-size: 26px; }

  /* ---- 缩略图行 ---- */
  .thumb-row img, .thumb-row video { width: 40px; height: 54px; }

  /* ---- 按钮 ---- */
  .btn { padding: 9px 14px; font-size: 13px; }
}

/* 超小屏 (≤480px) */
@media (max-width: 480px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .stat { flex-direction: column; align-items: flex-start; gap: 4px; }
  .view { padding: 14px 12px; }
}
