:root {
  --bg: #f6f7f9; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f5bea; --accent-ink: #fff; --danger: #c4302b; --hover: #f0f3fa;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
[hidden] { display: none !important; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 6px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { background: var(--hover); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
input, select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); min-height: 1em; margin: 4px 0; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.auth-card { width: min(360px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.auth-card button { justify-content: center; padding: 9px; }

.top { display: flex; align-items: center; gap: 24px; padding: 0 20px; height: 54px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 650; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tabs button { border: 0; background: none; border-radius: 0; padding: 16px 12px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.me { display: flex; align-items: center; gap: 4px; color: var(--muted); }

main { max-width: 1100px; margin: 0 auto; padding: 18px 20px 120px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.actions, .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chk { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 15px; }
.crumbs button { border: 0; background: none; padding: 4px 6px; }
.crumbs .sep { color: var(--muted); }

.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.list th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.list td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--hover); }
.list .num { text-align: right; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.list .ck { width: 34px; }
.list .ops { text-align: right; white-space: nowrap; }
.list .ops button { padding: 3px 8px; font-size: 13px; }
.name { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; overflow-wrap: anywhere; min-width: 0; }
.name:hover { color: var(--accent); }
.ico { width: 26px; height: 20px; flex: none; border-radius: 4px; display: inline-grid; place-items: center; font-size: 9px; font-weight: 700; letter-spacing: -.2px; color: #fff; background: #8a93a6; overflow: hidden; }
.ico.dir { background: #e5a72b; }
.ico.img { background: #2fa36b; }
.ico.vid { background: #8a4fd6; }
.ico.doc { background: #2f5bea; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--hover); color: var(--muted); }
.tag.warn { background: #fdecea; color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.drop { position: relative; }
.dropHint { display: none; position: absolute; inset: 0; border: 2px dashed var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); place-items: center; font-size: 16px; color: var(--accent); }
.drop.over .dropHint { display: grid; }

.queue { position: fixed; right: 20px; bottom: 20px; width: 340px; max-height: 50vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(20,30,60,.12); padding: 10px 14px; }
.q-item { padding: 6px 0; font-size: 13px; }
.q-item .q-name { display: flex; justify-content: space-between; gap: 8px; }
.q-item .q-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.q-bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.q-item.fail .q-bar i { background: var(--danger); }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(20,30,60,.2); }
dialog::backdrop { background: rgba(20,25,40,.35); }
.dlg { padding: 22px; width: min(460px, 90vw); display: flex; flex-direction: column; gap: 10px; }
.dlg h2 { margin: 0; font-size: 17px; }
.dlg label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.dlg input, .dlg select { width: 100%; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; justify-content: center; }
.seg button.on { background: var(--accent); color: #fff; }
.copybox { display: flex; gap: 6px; }
.copybox input { flex: 1; font-size: 12px; }

.preview { width: min(1000px, 94vw); }
.pv-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.pv-body { display: grid; place-items: center; background: #111; min-height: 300px; max-height: 80vh; }
.pv-body img, .pv-body video { max-width: 100%; max-height: 80vh; display: block; }

@media (max-width: 720px) {
  .top { display: grid; grid-template-columns: 1fr auto; height: auto; padding: 8px 12px 0; gap: 4px 8px; }
  .tabs { grid-column: 1 / -1; order: 3; overflow-x: auto; white-space: nowrap; }
  .tabs button { padding: 8px 10px 10px; flex: none; }
  .me { font-size: 13px; }
  main { padding: 12px 10px 120px; }
  .list .hide-sm { display: none; }
  .list td, .list th { padding: 8px 6px; }
  .list td:nth-child(2) { min-width: 120px; }
  .list .ops { white-space: normal; }
  .list .ops button { padding: 3px 7px; margin: 1px 0; }
  .queue { left: 10px; right: 10px; width: auto; }
}
