:root {
  --bg: #0b0e17;
  --panel: #121627;
  --panel-2: #171b2e;
  --line: #262c46;
  --text: #e9ecf7;
  --muted: #98a0ba;
  --accent: #4f7cff;
  --accent-2: #7c5cff;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --radius: 14px;
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 15% -10%, #1a2240 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; }
a { color: #93b4ff; text-decoration: none; }

/* ---------- 登录 / 初始化 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px; background: linear-gradient(180deg, #161a2d, #111420);
  border: 1px solid var(--line); border-radius: 18px; padding: 32px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
}
.auth-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: .5px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; line-height: 1.6; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: #0d1120; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 16px;
  background: var(--accent); color: #fff; font-weight: 600; transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); font-weight: 500; }
.btn.ghost:hover { border-color: #3a4166; background: #161b30; }
.btn.danger { background: #b91c1c; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.error-text { color: var(--err); font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- 应用框架 ---------- */
.app { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.sidebar {
  background: #0d101c; border-right: 1px solid var(--line); padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
}
.brand .title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.brand .title small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  background: transparent; border: 0; text-align: left; padding: 9px 12px; border-radius: 9px;
  color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.nav button:hover { background: #141a2c; color: var(--text); }
.nav button.active { background: #18203a; color: #fff; }
.nav .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .9; }
.side-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.side-foot .row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }

.main { padding: 24px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .desc { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #151a2b; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; }
.chip.ok b { color: var(--ok); }
.chip.warn b { color: var(--warn); }
.chip.err b { color: var(--err); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.panel h3 { margin: 0 0 4px; font-size: 15px; }
.panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; line-height: 1.6; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar select, .toolbar input[type=text], .toolbar input[type=search] {
  background: #0d1120; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none;
}
.toolbar input[type=search] { min-width: 210px; }
.toolbar .spacer { flex: 1; }

/* ---------- 素材 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; }
.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  cursor: pointer; transition: border-color .15s ease, transform .12s ease; position: relative;
}
.card:hover { border-color: #3a436b; transform: translateY(-1px); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card .thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: #0a0d17; }
.card .meta { padding: 9px 10px; }
.card .meta .name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .line { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }
.badge {
  position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 6px;
  background: rgba(10, 13, 23, .8); border: 1px solid rgba(255, 255, 255, .12); font-size: 11px;
}
.badge.video { color: #fbbf24; }
.badge.image { color: #93c5fd; }
.check {
  position: absolute; top: 8px; right: 8px; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .5); background: rgba(10, 13, 23, .6);
  display: grid; place-items: center; font-size: 12px; color: transparent;
}
.card.selected .check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 工作台 ---------- */
.work { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.preview {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; position: sticky; top: 16px;
}
.preview img, .preview video { width: 100%; border-radius: 9px; display: block; background: #000; }
.preview .pname { font-size: 12px; color: var(--muted); margin-top: 8px; word-break: break-all; }
.lang-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.lang-tabs button {
  background: #101425; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12px;
}
.lang-tabs button.active { border-color: var(--accent); color: #fff; background: #17203a; }
.lang-tabs button .mark { color: var(--ok); margin-left: 4px; }
textarea.copy {
  width: 100%; min-height: 190px; background: #0d1120; border: 1px solid var(--line);
  border-radius: 11px; padding: 12px; line-height: 1.65; resize: vertical; outline: none;
}
textarea.copy:focus { border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.page-list { display: grid; gap: 8px; }
.page-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel-2);
}
.page-item .pname { flex: 1; min-width: 0; }
.page-item .pname .n { font-size: 13px; }
.page-item .pname .id { font-size: 11px; color: var(--muted); }
.page-item select { background: #0d1120; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: 12px; }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.tbl tr:last-child td { border-bottom: 0; }
.status { padding: 2px 9px; border-radius: 999px; font-size: 11px; display: inline-block; }
.status.pending { background: rgba(251, 191, 36, .12); color: var(--warn); }
.status.running { background: rgba(79, 124, 255, .14); color: #93b4ff; }
.status.done { background: rgba(52, 211, 153, .12); color: var(--ok); }
.status.failed { background: rgba(248, 113, 113, .12); color: var(--err); }
.err-cell { color: #fca5a5; font-size: 12px; max-width: 340px; word-break: break-word; }

.tabs-mini { display: flex; gap: 6px; }
.tabs-mini button { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.tabs-mini button.active { color: #fff; border-color: var(--accent); background: #17203a; }

.empty { padding: 36px 12px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.8; }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: #1b2138; border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 11px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); max-width: 380px;
}
.toast.ok { border-color: rgba(52, 211, 153, .45); }
.toast.err { border-color: rgba(248, 113, 113, .5); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 6, 12, .7); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  width: 100%; max-width: 560px; background: #12172a; border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; max-height: 86vh; overflow: auto;
}
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal .sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
code.inline { background: #0d1120; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 12px; word-break: break-all; }

@media (max-width: 1100px) {
  .work { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { padding: 0 12px 0 4px; }
  .nav { flex-direction: row; }
  .side-foot { display: none; }
  .main { padding: 16px; }
  .row-2 { grid-template-columns: 1fr; }
}