:root {
  --ink: #111111; --ink-2: #555555; --ink-3: #999999; --line: #ececec; --soft: #f6f6f6;
  --brand: #ff5b1f; --ok: #22a06b; --err: #e5484d; --warn: #d97706;
  --side: 264px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #fff; color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
svg { display: block; flex: none; }

.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 16px; letter-spacing: -.01em; }
.brand i { width: 22px; height: 22px; border-radius: 6px; background: #151514; position: relative; flex: none; }
.brand i::after { content: ""; position: absolute; left: 8px; top: 6px; border-left: 8px solid var(--brand); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px;
  border: 0; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; position: relative; overflow: hidden; white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn:disabled { cursor: default; }
.btn.line { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, .18); transition: width .2s; }
.btn span, .btn svg { position: relative; }
.link { border: 0; background: none; padding: 0; color: var(--ink-3); font-size: 13px; }
.link:hover { color: var(--ink); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
aside {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line);
  padding: 20px 12px calc(20px + env(safe-area-inset-bottom)); background: #fff;
}
aside > .brand { padding: 0 8px; height: 32px; margin-bottom: 18px; }
.new { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 8px; font-weight: 600; margin-bottom: 14px; }
.new:hover, .new.on { background: var(--soft); }
.item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.item:hover { background: #fafafa; }
.item.on { background: var(--soft); }
.item .th { width: 48px; height: 27px; border-radius: 4px; background: var(--soft); overflow: hidden; flex: none; display: grid; place-items: center; }
.item .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item .tx { min-width: 0; flex: 1; }
.item .n { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 12px; color: var(--ink-3); }
.item .m.err { color: var(--err); }
.mini { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #d4d4d4; border-top-color: var(--ink); animation: spin .9s linear infinite; }
.bang { width: 14px; height: 14px; border-radius: 50%; background: var(--err); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

main { min-width: 0; }
.topbar { display: none; }
.view { max-width: 880px; margin: 0 auto; padding: 56px 48px 80px; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 4px; word-break: break-word; }
.sub { color: var(--ink-3); font-size: 13px; margin: 0 0 24px; }

/* ---------- new ---------- */
.new-view { max-width: 600px; }
.new-view h1 { margin-bottom: 24px; }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  height: 168px; border: 1.5px dashed #dcdcdc; border-radius: 12px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--ink); background: #fcfcfc; }
.drop b { font-weight: 600; font-size: 15px; margin-top: 6px; }
.drop small { color: var(--ink-3); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.files { list-style: none; margin: 8px 0 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.files .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .sz { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.files button { border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; width: 28px; height: 28px; border-radius: 6px; }
.files button:hover { background: var(--soft); color: var(--ink); }
textarea {
  display: block; width: 100%; margin: 16px 0; min-height: 96px; resize: vertical; padding: 12px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fff;
}
textarea:focus { border-color: #bdbdbd; }
textarea::placeholder { color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.err { color: var(--err); font-size: 13px; margin: 0; }

/* ---------- job ---------- */
.stage {
  aspect-ratio: 16 / 9; border-radius: 12px; background: #fafafa; border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; position: relative; overflow: hidden;
}
.stage b { font-size: 15px; font-weight: 600; }
.stage p { margin: 0; color: var(--ink-3); font-size: 13px; }
.stage .btn { margin-top: 8px; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #e2e2e2; border-top-color: var(--ink); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stage.run::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink), transparent); background-size: 40% 100%; background-repeat: no-repeat;
  animation: slide 1.8s ease-in-out infinite;
}
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.mark { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; }
.mark.err { background: var(--err); }
.mark.warn { background: var(--warn); }
.mark.off { background: #c8c8c8; }
.under { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; min-height: 20px; }
.under .t { color: var(--ink-3); font-size: 13px; }
video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #000; }
.done-row { margin-top: 16px; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; padding: 20px; z-index: 20; }
.login form { width: min(320px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }
.login input { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; font-size: 16px; outline: 0; text-align: center; }
.login input:focus { border-color: #bdbdbd; }
.login .err { text-align: center; min-height: 20px; }

/* ---------- mobile ---------- */
.scrim { display: none; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  aside {
    position: fixed; z-index: 10; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); height: auto;
    transform: translateX(-100%); transition: transform .22s ease; padding-top: calc(20px + env(safe-area-inset-top));
  }
  .app.open aside { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .12); }
  .app.open .scrim { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(0, 0, 0, .2); }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5;
    height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .icon { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; }
  .view { padding: 24px 16px calc(48px + env(safe-area-inset-bottom)); }
  .row .btn { flex: 1 1 100%; }
}
