:root {
  --accent: #e08324;
  --accent-d: #b9651a;
  --ok: #2e9d57;
  --err: #d0443a;
  --line: #ebe6e0;
  --muted: #7b7b7b;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: #f4f1ed; color: #222; font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--accent-d); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.mono { font-family: Consolas, Menlo, monospace; }
.muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 9px 14px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--accent-d); text-decoration: none; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: #f3d2b1; border: 1px solid rgba(243, 210, 177, .45); }
.btn.ghost:hover { background: rgba(255, 255, 255, .08); }
.btn.line { background: #fff; color: var(--accent-d); border: 1px solid var(--accent); }
.btn.danger { background: #fff; color: var(--err); border: 1px solid #efb3ae; }
.btn.danger:hover { background: #fdecea; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 登录 */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(145deg, #0b0b0b, #3a2414 48%, #1a120c); }
.login-card { width: min(340px, 90vw); background: #fff; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card img { width: 180px; margin: 0 auto; filter: invert(1) brightness(.3); }
.login-card h2 { margin: 0 0 6px; }
.login-card input { padding: 11px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px; }
.login-card .btn { justify-content: center; padding: 11px; }
.login-err { color: var(--err); min-height: 18px; font-size: 13px; }

/* 顶栏 */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 18px;
  background: linear-gradient(120deg, #111, #3a2414); color: #fff; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.brand img { height: 26px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px; order: 3; flex-basis: 100%; }
.stat { background: rgba(255, 255, 255, .1); border-radius: 8px; padding: 4px 10px; font-size: 12px; color: #f0dccb; white-space: nowrap; }
.stat b { color: #fff; font-size: 14px; margin-left: 3px; }
.stat.warn b { color: #ffc56b; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.tabs { display: flex; gap: 4px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); background: #fff; }
.tabs button {
  border: 0; background: transparent; padding: 10px 16px; font-size: 14px; cursor: pointer; color: #666;
  border-bottom: 3px solid transparent; font-weight: 600;
}
.tabs button.on { color: var(--accent-d); border-bottom-color: var(--accent); }
.main { padding: 14px 18px 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select { padding: 7px 10px; border: 1px solid #d9d2ca; border-radius: 8px; font-size: 13px; background: #fff; }
.filters #fQ, .filters #uQ { flex: 1; min-width: 200px; }

.table-wrap { background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
#filesTable { min-width: 1120px; }
#uploadsTable { min-width: 980px; }
table.grid td.fcol { min-width: 260px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid #f1ece6; text-align: left; vertical-align: top; }
table.grid th { background: #faf7f3; color: #6d6259; font-weight: 600; font-size: 12px; position: sticky; top: 0; white-space: nowrap; }
table.grid tr:hover td { background: #fffaf4; }
table.grid td.nw { white-space: nowrap; }
table.grid .fname { font-weight: 600; word-break: break-all; }
table.grid .sub { color: var(--muted); font-size: 12px; word-break: break-all; }
table.grid .fault { max-width: 320px; white-space: pre-wrap; word-break: break-all; max-height: 3.4em; overflow: hidden; color: #555; }
table.grid .acts { white-space: nowrap; }
table.grid .acts a, table.grid .acts button { margin-right: 8px; font-size: 12px; }
.linkbtn { border: 0; background: none; color: var(--accent-d); cursor: pointer; padding: 0; font-size: 12px; }
.linkbtn.danger { color: var(--err); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #f1ece6; color: #6b5a4a; margin: 0 3px 2px 0; }
.chip.ok { background: #e3f4ea; color: var(--ok); }
.chip.warn { background: #fdf1d9; color: #9a6a06; }
.chip.err { background: #fbe4e2; color: var(--err); }
.chip.blue { background: #e4eefb; color: #2d64b3; }

.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 0; font-size: 13px; color: #666; }
.pager button { border: 1px solid #ddd; background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }

/* 抽屉 */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: #fff; z-index: 40;
  box-shadow: -10px 0 40px rgba(0, 0, 0, .2); display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; flex: 1; font-size: 16px; word-break: break-all; }
.x { border: 0; background: none; font-size: 18px; cursor: pointer; color: #888; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px 40px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; margin-bottom: 14px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div { word-break: break-all; }
.block { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.block h4 { margin: 0 0 10px; font-size: 14px; }
.form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.form-row input, .form-row textarea { flex: 1; padding: 7px 10px; border: 1px solid #d9d2ca; border-radius: 8px; font-size: 13px; font-family: inherit; min-width: 160px; }
.form-row textarea { min-height: 80px; }
pre.json { background: #1d1f21; color: #d6e0ea; border-radius: 8px; padding: 12px; font-size: 12px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 60; display: grid; place-items: center; }
.modal-card { width: min(520px, 92vw); background: #fff; border-radius: 14px; padding: 20px; max-height: 86vh; overflow: auto; }
.modal-card h3 { margin: 0 0 12px; }
.modal-card .bar { height: 8px; background: #eee; border-radius: 6px; overflow: hidden; margin: 10px 0; }
.modal-card .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.modal-card .log { font-size: 12px; color: #555; max-height: 240px; overflow: auto; line-height: 1.7; }
.modal-card .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 18px;
  border-radius: 10px; z-index: 80; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); max-width: 90vw;
}
.toast.err { background: #a4281f; }
