:root {
  --bg: #f5f4f1; --panel: #fff; --line: #e4e1da; --text: #1f1d1a; --muted: #7b766d;
  --accent: #d9482b; --accent-soft: #fdeee9; --ok: #1f8a4c; --ok-soft: #e6f4ec; --warn: #a86a00; --warn-soft: #fbf1dc;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2 { font-size: 20px; } h3 { font-size: 15px; }
.muted { color: var(--muted); } .err { color: var(--accent); min-height: 1.6em; margin: 0; }
[hidden] { display: none !important; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 340px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; display: grid; gap: 14px; }
.login-box h1 { font-size: 20px; } .login-box p { margin: 0; }

.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: #1f1d1a; color: #cfcac1; padding: 22px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-size: 17px; font-weight: 600; padding: 0 10px 20px; }
.brand span { display: block; font-size: 12px; font-weight: 400; color: #8f897e; }
.side nav { display: grid; gap: 4px; }
.side nav a { padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.side nav a:hover { background: #2c2a26; }
.side nav a.on { background: var(--accent); color: #fff; }
.side-foot { margin-top: auto; font-size: 12px; padding: 0 10px; display: grid; gap: 4px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: #7b766d; }
.dot.ok { background: #4bc27d; } .dot.no { background: #e0694f; }

main { padding: 28px 32px 60px; min-width: 0; max-width: 1180px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card > h3 { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.full { grid-column: 1 / -1; }
label.f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; color: var(--text); background: #fff;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #bdb8ae; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.94); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { padding: 7px 16px; cursor: pointer; border-right: 1px solid var(--line); color: var(--text); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); color: #fff; }

.tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 20px; background: #efede8; color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.run { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--accent-soft); color: var(--accent); }
.note { background: var(--warn-soft); color: #6d4700; border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 10px 0; }
.note.bad { background: var(--accent-soft); color: #9a2c16; }
.empty { text-align: center; color: var(--muted); padding: 36px 0; }

.list { display: grid; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.item:hover { border-color: #bdb8ae; }
.item .thumb { width: 54px; height: 72px; border-radius: 6px; object-fit: cover; background: #efede8; flex: none; }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.frames { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.frames figure { margin: 0; flex: none; text-align: center; font-size: 11px; color: var(--muted); }
.frames img { height: 120px; border-radius: 6px; display: block; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
td.time { white-space: nowrap; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

.segcard { display: grid; grid-template-columns: 1fr 230px; gap: 18px; }
.segcard video, .player video { width: 100%; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; display: block; }
.placeholder { aspect-ratio: 9 / 16; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 12px; font-size: 13px; }
.final { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: start; }
.cast { display: flex; gap: 14px; align-items: flex-start; }
.cast img { width: 90px; border-radius: 8px; flex: none; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; margin-right: 5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1f1d1a; color: #fff; padding: 9px 18px; border-radius: 8px; z-index: 9; max-width: 80vw; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 8px; overflow-x: auto; }
  .brand { padding: 0 6px 0 0; font-size: 15px; white-space: nowrap; } .brand span, .side-foot { display: none; }
  .side nav { display: flex; } .side nav a { white-space: nowrap; padding: 6px 10px; }
  main { padding: 18px 16px 50px; }
  .grid2, .segcard, .final { grid-template-columns: 1fr; }
  .segcard video, .placeholder, .player video { max-width: 240px; }
}
